• I need e2 help!
    1 replies, posted
I recently made a simple lamp on/off e2 and was wondering why my strobing light code didnt work if anyone can help it would be great! Sorry im an e2 noob D: @name TESTING @inputs  @outputs Distance ON Fov Brightness Color:vector @persist  @trigger  runOnChat(1)      if(chatClk(owner())) {     T = owner():lastSaid():explode(" ")     # START OF ON/OFF COMMAND     elseif(T[1,string] == "/on") {     ON = 1       }     elseif(T[1,string] == "/off") {     ON = 0     }     #END OF ON/OFF COMMAND                             #Start of flashing elseif(T[1,string] == "/flash") { timer("timer1",2500) timer("timer2",3000)          if( clk("timer1") ) {        Color = vec(255,0,0)     }     elseif( clk("timer2") ) {       Color = vec(0,255,0)     } }     elseif (T[2,string] == "off") {     stoptimer("timerlol")     stoptimer("timerlol2")          }     #End of flashing                }
the code seems way over complicated in my opinion. first I would have one group of if / else for all your chat commands, and not have any actions within them. something like if(chat = blah) {blah} elseif(chat = blah2) {blah2} then when you do your flashing, I would have it be along the lines of: if chat = flash timer (timer1, 100) if(clk("timer1')) { color = on timer2, 100 } if(clk("timer2") { color = off timer1, 100 } etc etc. hopefully this general layout helps.
Sorry, you need to Log In to post a reply to this thread.