Just a heads up (took me about an hour to figure this out).
I'm sure you've all seen a <wait exact="5s" /> type tag, which would sleep the script for 5 seconds. But say you wanted to use a calculated time.
You have your variable.
<set_value name="$myvalue" exact="2" />
Then you do some math.
<set_value name="$mywaittime" exact="$myvalue * 5 - 8 + 3" />
If you try to do <wait exact="$mywaittime" /> it will fail because the number '5' isn't a time.
What ended up working was multiplying the number by one second. So to wait for the numerical value of $mywaittime in seconds: <wait exact="$mywaittime*1s" /> You can do that at any point in the calculation, so <set_value name="$mywaittime" exact="($myvalue * 5 - 8 + 3)*1s" /> would also work.
[FYI] Time Variables
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
there is a casting system in place. to convert time to an integer (will give you seconds value of the time)
like, if you have
<set_value name="$myvalue" exact="2min" />
<set_value name="$myvalueinteger" exact="($myvalue)i" />
the i after the variable convert it to an integer, in time case, its the number of seconds.
there is a lot of similar letters just like you can convert an integer to time by adding an s or min next to it. or to a distance by adding an m or km
min and km inside the binary as far as i could figure thanks to some error logs, are simply converted to s * 60s (so 10min end up 10s * 60s) same concept for km
look for "Default suffix" in scriptproperties.html
like, if you have
<set_value name="$myvalue" exact="2min" />
<set_value name="$myvalueinteger" exact="($myvalue)i" />
the i after the variable convert it to an integer, in time case, its the number of seconds.
there is a lot of similar letters just like you can convert an integer to time by adding an s or min next to it. or to a distance by adding an m or km
min and km inside the binary as far as i could figure thanks to some error logs, are simply converted to s * 60s (so 10min end up 10s * 60s) same concept for km
look for "Default suffix" in scriptproperties.html
-
- Posts: 100
- Joined: Tue, 24. Feb 09, 03:47