1. Post #641
    snipeissilent's Avatar
    May 2009
    144 Posts
    Hello all...

    I'm trying to make an ejection seat consisting of a seat weld latched to a plate. The seat has thrusters on the bottom and a balloon deployer on the back.

    What I need is for the weld latch to remain activated until I press the space bar, after which it cannot reactivate. 0.1 seconds after space is pressed, the weld latch disengages. 0.1 seconds after that, the thrusters activate and stay on for 2 seconds. They turn off, and the balloon deploys from the deployer.

    I more or less know how to do the timing using timer("name", time) and if (clk("name")), but I do not know how to make the weld latch be engaged at first then disengaged, unable to be activated again.
    I also don't know how to make it so I don't have to hold down the space bar.
    May someone make a full e2 for this dilemma? Thanks.

  2. Post #642
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    Code:
    @name Ejector
    @inputs Space
    @outputs Latch Balloon Thrusters
    if (first()) {Latch = 1}
    if (Space & ~Space & Latch) {timer("latch",100)}
    if (clk("latch")) {Latch = 0,timer("thruster",100)}
    if (clk("thruster")) {Thrusters = 1,timer("balloon",2000)}
    if (clk("balloon")) {Thrusters = 0,Balloon = 1}

  3. Post #643
    snipeissilent's Avatar
    May 2009
    144 Posts
    Thank you, although I ultimately ended up getting outside help. The code I decided on is:
    Code:
    @name Ejection Seat
    @inputs Space
    @outputs Weld Thrusters Balloon
    @persist 
    @trigger
    
    runOnTick(1)
    if (first()|duped()) {
        Weld=1
    }
    if (Space) {
        Weld=0
        timer("weld", 10)
    }
    if (clk("weld")) {
        Thrusters=1
        timer("thrust", 1500)
    }
    if (clk("thrust")) {
        Thrusters=0
        Balloon=1
    }
    However, I am having trouble with stability. I have 4 thrusters in 4 corners of a phx plate (smartsnapped), but the seat always spins out of control after the thrusters trigger. Keep upright and gyro cant be used because this is going in a plane and will eventually be going upside down. Is there any way, wire or not, that this seat's 1.5 seconds of flight time can be stabilized?

  4. Post #644
    _ExileZ_'s Avatar
    January 2010
    69 Posts
    May I request a "Anti-Dupe" code for E2's? It would be very useful + I have seen it before

  5. Post #645
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    May I request a "Anti-Dupe" code for E2's? It would be very useful + I have seen it before
    This is quite easy, or it is the way I do it.

    Just insert this into any E2 you don't want to be duped (works for contraptions too, just as long as the E2 is connected).

    Code:
    if((owner():steamID()!="STEAM_0:1:2345678") & (duped() | first())){ 
           selfDestructAll() 
    }

  6. Post #646
    Gold Member
    jlj1's Avatar
    May 2008
    3,632 Posts
    Anti Dupe code is somewhat useless If they really want the E2 they just ADV dupe it and edit the save
    Reply With Quote Edit / Delete Reply Guernsey Show Events Disagree Disagree x 1 (list)

  7. Post #647
    Gold Member
    ContiX's Avatar
    May 2008
    1,373 Posts
    May I request a little help in the right direction? I'm trying to make a chip that interfaces with the SBEP team's MCP; basically, a platform that moves when you give it coordinates.

    What I want to do should be fairly simple, but I lack the brain at the moment to figure it out...I want to make a series of variables that are changable by numpads. Meaning, if I push 4, the variable set for 4 something increments, and when I push 6, the variable decrements. The problem lies with getting the increment/decrement commands to work; is there a particular syntax used for them when used with if/then statements that I'm not getting?

    Also, how do I keep the variable increasing/decreasing permanently? I can get a value to change just by pushing a button, but how do I make it store the new value?

    Also, just for convenience' sake, how does the E2 timer syntax work? The Wire wiki wasn't very helpful...

    I don't need a full E2 or anything, just a push. Thanks!

  8. Post #648
    snipeissilent's Avatar
    May 2009
    144 Posts
    I want to make a series of variables that are changable by numpads. Meaning, if I push 4, the variable set for 4 something increments, and when I push 6, the variable decrements.

    Also, how do I keep the variable increasing/decreasing permanently? I can get a value to change just by pushing a button, but how do I make it store the new value?
    I believe the Advanced Input allows you to insert increment/decrement values.

    Also, just for convenience' sake, how does the E2 timer syntax work?
    The timer syntax I use is timer("name", time) and if(clk("name")) {action}.

    For example, say you want a timer to trigger after another event happens. My favorite example is a timed door that uses a timer to tell it when to close:

    Code:
    @name Door
    @inputs Spacebar
    @outputs Hydraulic
    @persist
    @trigger
    
    if (Spacebar) {
         Hydraulic=100
         timer("door", 2000) #This is where the timer begins, as soon as the hydraulic triggers.
    }
    if(clk("door") { #This line is the same as saying "Once it has reached the set time..."
         Hydraulic=0
    }
    Note that the time you put in (e.g. 2000) is seconds multiplied by 1000. A time of 2000 is 2 seconds, a time of 1000 is one second, a time of 500 is half a second, etc.
    __________________________________________________ __________________________

    As for my ejection seat, it appears that seat positioning and some rewiring are all I needed to fix. I have a working ejection seat now, only problem being that I need a plane to eject out of...

  9. Post #649
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    timer("unique_string_name",time_to_run_in_miliseco nds)

    So timer("bob",2000) would run in 2 seconds (2000 miliseconds is 2 seconds), and can be accessed using clk("bob").

  10. Post #650
    Gold Member
    ContiX's Avatar
    May 2008
    1,373 Posts
    So it works completely differently than the original Chip timer? If I wanted to execute three different things, I'd need three different timers?

    (Thanks for the quick reply!)

  11. Post #651
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    Indeed. A timer runs once from x miliseconds it was created. It executes the Expression 2. clk(S) checks if if the execution was caused by the timer S.

  12. Post #652
    snipeissilent's Avatar
    May 2009
    144 Posts
    So it works completely differently than the original Chip timer? If I wanted to execute three different things, I'd need three different timers?

    (Thanks for the quick reply!)
    No problem...
    You would need three different timers, but only if those three (or more) events were to be triggered at separate times. One timer may trigger as many events as you wish, but they will all happen at the instant that single timer expires.

    For example...

    Code:
    @name Door
    @inputs Spacebar
    @outputs Hydraulic Randomhydraulic
    @persist
    @trigger
    
    if (Spacebar) {
         Hydraulic=100
         Randomhydraulic=3691
         timer("door", 2000)
         timer("randomness", 3000)
    }
    if(clk("door")) {
         Hydraulic=0
    }
    if(clk("randomness")) {
         Randomhydraulic=1780
    }

  13. Post #653
    Gold Member
    ContiX's Avatar
    May 2008
    1,373 Posts
    Ah, that makes perfect sense now. Thanks!

  14. Post #654
    snipeissilent's Avatar
    May 2009
    144 Posts
    No problem.

  15. Post #655
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    I'm having a bit of trouble with a "door whitelist" E2 I'm making..

    The thing works, but for some reason when I try to create a error for the adding function it bugs out and saves blank strings.

    Heres the adding function..

    Code:
    if(LS:string(1)==">add" & CCheck){
        if(LS:string(2)!=""){
            S:writeString(">Searching for player..",1,X,999), X++
            
            if(findPlayerByName(LS:string(2))){
                Users:pushString(findPlayerByName(LS:string(2)):steamID())
                S:writeString(">>Player '"+LS:string(2)+"' added!",1,X,999)
                X+=2
                CCheck=0
                UNum++
            }
            else
            {
                S:writeString(">>Player '"+LS:string(2)+"' not found!",1,X,900)
                X+=2
                CCheck=0
            }
        }
    }
    As I stated it only stops working when I add in the error. So removing the if(findPlayerByName()){}else{} it works fine, but with it the pushString() doesn't run.

  16. Post #656
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    You can only run one find function per 100ms or so. You're running findPlayerByName twise. instead, put it in a variable. Check the variable, and if it contains an entity, push it into the array.

  17. Post #657
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    You can only run one find function per 100ms or so. You're running findPlayerByName twise. instead, put it in a variable. Check the variable, and if it contains an entity, push it into the array.
    Mkay, it works. Thanks for the help.

  18. Post #658
    FlameCow's Avatar
    November 2009
    2,881 Posts
    Does anyone know how to make a WASD controlled holo? Preferrably explained in the code.

  19. Post #659
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    I'll give it a go..

    Code:
    @name Holo
    @inputs Vehicle:wirelink #Wire this to the adv. pod controller your using.
    @persist Pos:vector Holo:entity
    interval(100)
    
    Holo=holoEntity(1)
    E=entity()
    Speed=100 #Sorta obvious
    
    if(first()){
        Pos=E:pos()
        holoCreate(1)
    }
    
    holoPos(1,Pos) #Tells this thing where to be
    holoAng(1,O:aimPos()) #Follow the players aim
    
    #Forward
    if(Vehicle["W",number]){Pos=Pos + Holo:forward()*Speed}
    
    #Backward
    if(Vehicle["S",number]){Pos=Pos - Holo:forward()*Speed}
    
    #Left (If I'm mistaken and left() is suppose to be right(), please forgive me.)
    if(Vehicle["A",number]){Pos=Pos + Holo:left()*Speed}
    
    #Right
    if(Vehicle{"D",number]){Pos=Pos - Holo:left()*Speed}
    Untested, but as far as I can tell it should work.

  20. Post #660
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    Nick, you forgot to persist Speed. You can also use += and -=.. Pos += Holo:forward()*Speed.

    Code:
    @name Holo
    @inputs Vehicle:wirelink #Wire this to the adv. pod controller your using.
    @persist Pos:vector [Holo E]:entity
    
    if(first()){
        E = entity()
        Pos = E:pos()
        Holo = holoCreate(1)
        Speed=10 #Sorta obvious
        runOnTick(1)
    }
    
    holoPos(1,Pos) #Tells this thing where to be
    holoAng(1,O:eyeAngles()) #Follow the players aim <- Not AimPos(), EyeAngles().
    
    #Forward
    if(Vehicle["W",number]){Pos=Pos + Holo:forward()*Speed}
    
    #Backward
    if(Vehicle["S",number]){Pos=Pos - Holo:forward()*Speed}
    
    #Left (If I'm mistaken and left() is suppose to be right(), please forgive me.)
    if(Vehicle["A",number]){Pos=Pos + Holo:left()*Speed}
    
    #Right
    if(Vehicle{"D",number]){Pos=Pos - Holo:left()*Speed}

  21. Post #661
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    Nick, you forgot to persist Speed. You can also use += and -=.. Pos += Holo:forward()*Speed.

    Code:
    @name Holo
    @inputs Vehicle:wirelink #Wire this to the adv. pod controller your using.
    @persist Pos:vector [Holo E]:entity
    
    if(first()){
        E = entity()
        Pos = E:pos()
        Holo = holoCreate(1)
        Speed=10 #Sorta obvious
        runOnTick(1)
    }
    
    holoPos(1,Pos) #Tells this thing where to be
    holoAng(1,O:eyeAngles()) #Follow the players aim <- Not AimPos(), EyeAngles().
    
    #Forward
    if(Vehicle["W",number]){Pos=Pos + Holo:forward()*Speed}
    
    #Backward
    if(Vehicle["S",number]){Pos=Pos - Holo:forward()*Speed}
    
    #Left (If I'm mistaken and left() is suppose to be right(), please forgive me.)
    if(Vehicle["A",number]){Pos=Pos + Holo:left()*Speed}
    
    #Right
    if(Vehicle{"D",number]){Pos=Pos - Holo:left()*Speed}
    I'm gonna guess those are mostly suggestions for optimization? The whole Pos=Pos + thing was just habit but as for making the speed variable a persist and only setting the values inside the first() function is just optional.

  22. Post #662
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    It uses less ops.

  23. Post #663
    snowboardmoose's Avatar
    March 2009
    301 Posts
    How about a chip that will play a sound at random times, but is simple enough to have more sounds written in.

  24. Post #664
    FlameCow's Avatar
    November 2009
    2,881 Posts
    Anyone know how to make a hologram reset it's position if you leave a specific vehicle?

  25. Post #665
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,622 Posts
    Anyone know how to make a hologram reset it's position if you leave a specific vehicle?
    Code:
    @name HReset
    @inputs Vehicle:wirelink
    @persist Act HPos:vector
    
    if(first()){
        runOnTick(1)
        Act=0
    }
    
    if(Vehicle["Active",number]){Act=1}
    if(!Vehicle["Active",number]){Act=0}
    
    if(Act=0){HPos=vec()}

  26. Post #666
    Rayza Black's Avatar
    November 2008
    287 Posts
    I wonder what Flamecow is making... :allears:

  27. Post #667

    September 2010
    1 Posts
    could you make an E2 that gives you wings?

  28. Post #668
    Decoy Ocelot's Avatar
    March 2009
    307 Posts
    Code:
    @name HReset
    @inputs Vehicle:wirelink
    @persist Act HPos:vector
    
    if(first()){
        runOnTick(1)
        Act=0
    }
    
    if(Vehicle["Active",number]){Act=1}
    if(!Vehicle["Active",number]){Act=0}
    
    if(Act=0){HPos=vec()}
    could, I belive, be optimized to:

    Code:
    @inputs Vehicle:wirelink
    @persist HPos:vector
    
    if(!Vehicle["Active",normal]) { holoPos(Index,Hpos) }

  29. Post #669
    ABS
    ABS's Avatar
    August 2010
    121 Posts
    Simple lockable door.

    Code:
    @name Door
    @inputs B1 B2 BL #B1 - Inside button, B2 - Outside ~, BL - Lock door
    @outputs H
    
    C=47 #Hydraulic length when closed
    T=3 #How many seconds should it be open for
    
    T=T*1000 #Converting seconds to milliseconds
    
    if (B1==1) {
        H=0
        timer("yeah", T)
    }
    
    if (B2==1) {
        if (BL==0) {
        H=0
        timer("yeah", T)
    }
    }
    
    if (clk("yeah")) {H=C}
    Also an indicator for lock button.

  30. Post #670
    Dark207's Avatar
    September 2010
    67 Posts
    Can you make an E2 connect to an NPC and make it your pet, but have a leveling system and upgrades, things like that.

  31. Post #671
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    I think that would count as a project, not just an E2.

  32. Post #672
    mariosuchy's Avatar
    April 2010
    37 Posts
    Holo - vector indication, please.

  33. Post #673
    Gold Member
    whosdr's Avatar
    July 2008
    3,017 Posts
    That doesn't mean anything. Explain.

  34. Post #674
    Gold Member
    ryan1271's Avatar
    February 2008
    1,130 Posts

    Could someone make this? You can simplify it if you want.

  35. Post #675
    mariosuchy's Avatar
    April 2010
    37 Posts
    I'm talking about something like this ( http://en.wikipedia.org/wiki/File:Torque_animation.gif )
    with an unit of N ( http://en.wikipedia.org/wiki/Newton_(unit) )

  36. Post #676
    ADV Scout's Avatar
    July 2010
    27 Posts
    Curses, my request left in the dust. Ah well.. i'll work on it my self.

  37. Post #677

    September 2010
    3 Posts
    I'm trying to make a rollermine e2. A holo rollermine on the players feet, moves when you move (in the direcction you move), Makes noise when it moves, maybe make it able to attack enemies (not much damage like 20)? Also have commands to make different noises like alert and yes and such. I have the basic part done already, but I can't get the idle noise quieter, the SoundVolume function doesn't work for me. Much appreciated
    @name RollerMine Player
    @inputs
    @outputs
    @persist
    @trigger

    if (first()) {entity():owner():soundPlay(0,0,"npc/roller/mine/rmine_reprogram.wav")
    entity():owner():setColor(0,0,0,0)
    entity():owner():setMaterial("Models/effects/vol_light001")
    holoCreate(1)
    holoModel(1,("sphere"))
    holoMaterial(1,("models/shiny/shinywhite"))
    holoScale(1,vec(1,1,1))
    holoColor(1,vec(0,0,255))
    holoAng(1,ang(0,0,0))
    #idle noise
    entity():owner():soundPlay(1,0,"npc/roller/mine/rmine_seek_loop2.wav")
    }
    holoPos(1,owner():shootPos()-vec(0,0,50))
    holoParent(1,owner())

    #Didn't finish this, For moving normally then the fast sound for sprinting.
    if(owner():vel():length()){entity():owner():soundP lay(2,0,"npc/roller/mine/rmine_moveslow_loop1.wav")}

  38. Post #678
    lostone1993's Avatar
    July 2010
    71 Posts
    could someone make me an e2 for a computer terminal ie i type in commands i can link the commands to other function so i need a screen a keyboard attached and for it when i prees enter it seaches for the command and if possible make it labeled so i know where to insert commands and maybe a flashing cursor

    thanks

  39. Post #679
    revdirty's Avatar
    June 2006
    14 Posts
    I would like to have a e2 chip to replace the advanaced gyropod. the ADV gyropod is buggy and crashes my server.. am looking to e2 code to replace basic gyropod fuctions like movment (forward, back, left, right, mouse aim, up, down , level and freeze.) and maybe and avtivate command. needs to also beable to adjust speed of movement to accomdate diffrent ship sizes and weights.

  40. Post #680
    40KEndgame's Avatar
    July 2010
    188 Posts
    I need three relatively complex E2s. This may be a lot of work.

    1. An E2 chip that replaces the Advanced Pod Controler and adds Joystick controls for a Logitec Attack 3 Joystick. (I've been needing this for a while, so if nothing else, at least make this one)

    2. An E2 that can work together with a hoverdrive/Spacebuild warp drive, a gfx screen, and a wired keyboard to create a free-range hyperdrive. (I could probably get something working with just wire, but it won't be very user friendly, so I need an E2)

    3. An E2 chip that can be used to turn a ragdoll into an NPC (mainly a ragdoll from the Pokemon prop packs).