[HELP] Adding a timer using var as interval (read for more details) |
Author: |
Message: |
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. [HELP] Adding a timer using var as interval (read for more details)
Hey.
Ok I am adding a timer and I am using a variable as the interval but I want to do some maths to it IE times it by 60000 to get it into milisecond format...
My script you enter the minutes into a box and click ok so lets say 1 it executes this...
code: var Time = config.GetControlText("IntervalTime");
AddTimer("updatepm", Time * 60000 );
This gives me an error basically its meant to go Time (Usually 1 or similar) gets times by 60000 to give how many miliseconds...
Help please >.<
Thanks,
Kriogenic.
|
|
08-10-2007 03:23 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: [HELP] Adding a timer using var as interval (read for more details)
If you'd have posted the error, we could've seen much faster what's wrong. AddTimer is a child function of the MsgPlus object, so you need to use:
code: var Time = config.GetControlText("IntervalTime");
MsgPlus.AddTimer("updatepm", Time * 60000 );
This post was edited on 08-10-2007 at 03:27 PM by Matti.
|
|
08-10-2007 03:27 PM |
|
|
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. RE: [HELP] Adding a timer using var as interval (read for more details)
I do that all the time... Always forget that... Then I always think the problem is something else >.<
My 2 biggest errors... Forgetting MsgPlus. and forgetting its cap sensative...
Thanks for your help.
Kriogenic.
|
|
08-10-2007 03:31 PM |
|
|
roflmao456
Skinning Contest Winner
Posts: 955 Reputation: 24
30 / /
Joined: Nov 2006
Status: Away
|
RE: [HELP] Adding a timer using var as interval (read for more details)
A suggestion: If you keep doing this, you might want to just create a function:
code: function AddTimer(TimerId, Interval){
MsgPlus.AddTimer(TimerId, Interval);
}
This post was edited on 08-10-2007 at 10:47 PM by roflmao456.
[quote]
Ultimatess6: What a noob mod
|
|
08-10-2007 10:46 PM |
|
|
LifelesS
Full Member
Posts: 115 Reputation: 4
32 / /
Joined: Dec 2006
|
RE: [HELP] Adding a timer using var as interval (read for more details)
What I usually do is a function like
code: function Timer(Id, TimeSec)
{
return MsgPlus.AddTimer(Id, TimeSec*1000)
}
Or I just change the number of zeros, depending of what I want, to keep things easy
Best Regards,
Joćo Godinho
|
|
08-11-2007 12:49 AM |
|
|
ShawnZ
Veteran Member
Posts: 3146 Reputation: 43
32 / /
Joined: Jan 2003
|
RE: [HELP] Adding a timer using var as interval (read for more details)
quote: Originally posted by roflmao456
A suggestion: If you keep doing this, you might want to just create a function:
code: function AddTimer(TimerId, Interval){
MsgPlus.AddTimer(TimerId, Interval);
}
why not just AddTimer=MsgPlus.AddTimer?
Spoiler: the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
|
|
08-11-2007 01:23 AM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: [HELP] Adding a timer using var as interval (read for more details)
quote: Originally posted by roflmao456
A suggestion: If you keep doing this, you might want to just create a function:
code: function AddTimer(TimerId, Interval){
MsgPlus.AddTimer(TimerId, Interval);
}
You are better off just doing this to the whole lot
code: with(MsgPlus){
//put your code here
AddTimer("updatepm", Time * 60000 );
//put some more code here
}
This code is also very helpful if you are using the same object quite a few times in a small area, it just saves you writing it out all the time.
This post was edited on 08-11-2007 at 01:59 AM by markee.
|
|
08-11-2007 01:58 AM |
|
|
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. RE: [HELP] Adding a timer using var as interval (read for more details)
Hmm thanks. These ideas will help.
Thanks again people,
Kriogenic.
|
|
08-11-2007 06:41 AM |
|
|
|