+ Reply to Thread
Results 1 to 5 of 5

Thread: E2 timer function

  1. #1
    Wire Amateur wel97459's Avatar
    Join Date
    Nov 2008
    Location
    CA
    Posts
    30

    Smile E2 timer function

    Ok the clk timer comand is all well and good if just want too see if a timer is being called.

    Now what if you want to get, any timer that's being called and its name.

    Well to my knowledge there's noway to do this right now, shot of testing for all the timer names that your going to use in your E2 code, and thats to mini if statements.

    So this is the code that need to be add in the timer.lua file:

    Code:
    registerFunction("runner", "", "s", function(self, args)
      if runner == nil 
    	then return "" else return runner end
    end)

  2. #2
    Wirererer Maxaxle's Avatar
    Join Date
    Sep 2009
    Posts
    177

    Default Re: E2 timer function

    ...so THAT'S why I can't make a CS:S C4 explosive with E2! Thanks!


    But...wait...do you just slap it on the end of the file...or what?
    Still very clueless about code in general.
    92% of teens have moved onto rap. If you are part of the 8% that still listen to real music, copy and paste this into your signature.

  3. #3
    Wire Sofaking N00bDud3's Avatar
    Join Date
    Jul 2009
    Location
    Error: Unknown Location
    Posts
    1,252

    Default Re: E2 timer function

    Very useful, but I like how you suggested this 6 hours after I did
    Make clk() return name of timer
    And it's been suggested and coded a few times before:
    http://www.wiremod.com/forum/e2-deve...per-runby.html
    http://www.wiremod.com/forum/e2-deve...ntityvars.html



  4. #4
    Wire Amateur wel97459's Avatar
    Join Date
    Nov 2008
    Location
    CA
    Posts
    30

    Default Re: E2 timer function

    Quote Originally Posted by Maxaxle View Post
    ...so THAT'S why I can't make a CS:S C4 explosive with E2! Thanks!


    But...wait...do you just slap it on the end of the file...or what?
    Code:
    registerFunction("clk", "s", "n", function(self, args)
    	local op1 = args[2]
    	local rv1 = op1[1](self, op1)
    	if runner == rv1
    	   then return 1 else return 0 end
    end)
    
    <<<<<<<<<<<goes right here in the file
    
    /******************************************************************************/

  5. #5
    Bug Buster TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,796

    Default Re: E2 timer function

    Quote Originally Posted by Maxaxle View Post
    ...so THAT'S why I can't make a CS:S C4 explosive with E2! Thanks!
    no, the reason for that is that you're a noob

    [highlight=E2]@name CrapStrike bomb
    @inputs Active
    @outputs Seconds

    if (~Active) {
    if (Active) {
    Seconds = 30
    interval(1000)
    }
    else {
    Seconds = 0
    stoptimer("interval")
    }
    }
    if (clk()) {
    Seconds--
    if (Seconds) { interval(1000) }
    }[/highlight]

    You can even do that with gates, but that's a lot harder
    "It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup

    L&#237;fi&#240; l&#230;&#240;ist l&#250;mskt &#225;fram

+ Reply to Thread

Similar Threads

  1. "if (condition) {function} {function}" is incorrect syntax?
    By Maxaxle in forum Installation and Malfunctions Support
    Replies: 8
    Last Post: 12-31-2009, 11:38 AM
  2. Replies: 4
    Last Post: 07-16-2009, 02:18 AM
  3. Exp2 timer() Function
    By Flaver in forum Expression 2 Discussion & Help
    Replies: 4
    Last Post: 06-19-2009, 07:25 AM
  4. [REQUEST] How to make a expression gate that has a timer and a smoother function
    By funkake in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 5
    Last Post: 09-17-2008, 11:05 PM
  5. is there a timer function for the e-gate?
    By undead82004 in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 06-16-2007, 02:24 AM

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