+ Reply to Thread
Results 1 to 5 of 5

Thread: E2 Remote Trail Maker

  1. #1
    Wire Noob MPAP25438's Avatar
    Join Date
    Mar 2010
    Location
    owner():pos()
    Posts
    23

    Talking E2 Remote Trail Maker

    Hello again
    This time I post a Chip wich is really useless but funny
    Its a Remote Trail Maker!
    Easy to use:
    type "$ new" to create a new trai on you
    type "$ length" to change the Length of the trail (0 is minimum, 10 is maximum!)
    type "$ ssize" to change the start size of the trail (0 is minimum, 100 is maximum)
    type "$ esize" to change th End size of the trail (0is minimum, 100 is maximum)
    type "$ off" to remove your trail
    type "$ col R G B" to change the Color off the trail (example: "$ col 255 120 0" for an orange trail)
    type "$ texture texture" to change the texture of the trail (exampe: "$texture pasma" for a trail with the plasma texture)
    type "$ alpha" to change the alpha of the trail (0 is invisible 255 is complete visible)
    type "$ all" to give everyone on the server a trail (chip owner only!)

    Tip: if it dont work try it again without the "" (xD)

    Every one on the server is able to use every command exclude the "$ all" command

    Here is the code:

    Code:
    @name MP-inc Remote Trail maker
    @inputs 
    @outputs R G B A SSize ESize Length Texture:string
    @persist R G B A SSize ESize Length Texture:string Players:array
    runOnChat(1)
    Last = lastSpoke()
    Said = lastSaid():lower():explode(" ")
    SID = Last:id()
    C = chatClk()
    CMD = Said[1,string]=="$"
    Arg = Said[2,string]
    if(first()){
        concmd("say [MP-inc Remote Trail maker Activated]")
    }
    if(C&CMD&Arg=="new"){
        SSize = 20
        ESize = 0
        Length = 2
        Texture = "laser"
        R = teamColor(Last:team()):x()
        G = teamColor(Last:team()):y()
        B = teamColor(Last:team()):z()
        A = 255
        holoEntity(SID):removeTrails()
        holoDelete(SID)
        holoCreate(SID)
        holoPos(SID,Last:pos()+vec(0,0,5))
        holoParent(SID,Last)
        holoScale(SID,vec(0,0,0))
        holoEntity(SID):setTrails(20,0,2,"trails/laser",teamColor(Last:team()),255)
        gSetNum(SID+"ssize",SSize)
        gSetNum(SID+"esize",ESize)
        gSetNum(SID+"length",Length)
        gSetStr(SID+"texture",Texture)
        gSetNum(SID+"r",R)
        gSetNum(SID+"g",G)
        gSetNum(SID+"b",B)
        gSetNum(SID+"a",A)
    }
    if(C&CMD&Arg=="ssize"){
        if(Said[3,string]:toNumber()>120){
            soundPurge()
            holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
        }
        else{
            SSize = Said[3,string]:toNumber()
        }
        gSetNum(SID+"ssize",SSize)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    if(C&CMD&Arg=="esize"){
        if(Said[3,string]:toNumber()>120){
            holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
        }
        else{
            ESize = Said[3,string]:toNumber()
        }
        gSetNum(SID+"esize",ESize)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    if(C&CMD&Arg=="length"){
        if(Said[3,string]:toNumber()>10){
            holoEntity(SID):soundPlay(SID,2,"ambient/alarms/klaxon1.wav")
        }
        else{
            Length = Said[3,string]:toNumber()
        }
        gSetNum(SID+"length",Length)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    if(C&CMD&Arg=="texture"){
        Texture = Said[3,string]
        gSetStr(SID+"texture",Texture)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    if(C&CMD&Arg=="col"){
        R = Said[3,string]:toNumber()
        G = Said[4,string]:toNumber()
        B = Said[5,string]:toNumber()
        gSetNum(SID+"r",R)
        gSetNum(SID+"g",G)
        gSetNum(SID+"b",B)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    if(C&CMD&Arg=="alpha"){
        A = Said[3,string]:toNumber()
        gSetNum(SID+"a",A)
        holoEntity(SID):removeTrails()
        holoEntity(SID):setTrails(gGetNum(SID+"ssize"),gGetNum(SID+"esize"),gGetNum(SID+"length"),"trails/"+gGetStr(SID+"texture"),vec(gGetNum(SID+"r"),gGetNum(SID+"g"),gGetNum(SID+"b")),gGetNum(SID+"a"))
    }
    
    if(C&CMD&Arg=="off"){
        holoEntity(SID):removeTrails()
        holoDelete(SID)
    }
    
    if(chatClk(owner())&CMD&Arg=="all"){
        hideChat(1)
        findByClass("player")
        Players = findToArray()
        for(I=1,Players:count()){
            Player = Players[I,entity]
            PID = Player:id()
            holoCreate(PID)
            holoPos(PID,Player:pos()+vec(0,0,5))
            holoParent(PID,Player)
            holoScale(PID,vec(0,0,0))
            holoEntity(PID):setTrails(20,0,2,"trails/laser",teamColor(Player:team()),255)
            holoAlpha(PID,0)
        }
    }
    if(chatClk(owner())&CMD&Arg=="remove"){
        hideChat(1)
        gDeleteAll()
        selfDestruct()
    }
    its still very messy but it works great!
    find some bugs? post them here please
    Last edited by MPAP25438; 04-19-2010 at 10:30 PM. Reason: |3ulletje sayd do it so i did it
    Snake67: your Server crashes very often... <.<
    MGN | Chris: yea...
    Snake67: can't you do something against it?
    MGN | Chris: sure i just type nocrash 1 in the server.cfg
    Snake67: ...
    Snake67: this command exists ?!

  2. #2
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: E2 Remote Trail Maker

    Why do you save all the player data into global variables?
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  3. #3
    Wire Noob MPAP25438's Avatar
    Join Date
    Mar 2010
    Location
    owner():pos()
    Posts
    23

    Default Re: E2 Remote Trail Maker

    so if i unintentionally remove the chip the settings are still there :P
    Snake67: your Server crashes very often... <.<
    MGN | Chris: yea...
    Snake67: can't you do something against it?
    MGN | Chris: sure i just type nocrash 1 in the server.cfg
    Snake67: ...
    Snake67: this command exists ?!

  4. #4
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: E2 Remote Trail Maker

    Ah I see.
    But when you intentionally remove the chip, they are also still there.
    Gvars are not cheap and you use a load of them. You shouldn't let them be there until the server restarts.

    Add this to remove your chip intentionally, that should get rid of those Gvars properly.
    Code:
    if(chatClk(owner())&CMD&Arg=="remove"){
        hideChat(1)
        gDeleteAll()
        selfDestruct()
    }
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  5. #5
    Wire Noob MPAP25438's Avatar
    Join Date
    Mar 2010
    Location
    owner():pos()
    Posts
    23

    Default Re: E2 Remote Trail Maker

    Edited the first post
    Thank you for optimizing my Chips xD
    Snake67: your Server crashes very often... <.<
    MGN | Chris: yea...
    Snake67: can't you do something against it?
    MGN | Chris: sure i just type nocrash 1 in the server.cfg
    Snake67: ...
    Snake67: this command exists ?!

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots