|
Private Adept
Joined: 10 Jan 2002 Posts: 264 Location: USA
|
Posted: Tue Apr 13, 2010 6:10 pm
(@solved - %confused) confused on where to use %eval |
in zmud part of an alias was:
Code: |
#MATH quest_time (%secs - @quest_start_time)/1000
#IF (@quest_time > 59) {
#MATH quest_minute_time {@quest_time/60}
#MATH quest_leftover_time {@quest_minute_time*60}
#MATH quest_second_time {@quest_time-@quest_leftover_time}
} {quest_second_time = @quest_time}
|
to make it at least work in cmud it is now...
Code: |
quest_time = %eval((%secs - @quest_start_time) / 1000)
#IF (@quest_time > 59) {
quest_minute_time = %eval(@quest_time / 60)
quest_leftover_time = %eval(@quest_minute_time * 60)
quest_second_time = %eval(@quest_time - @quest_leftover_time)
} {quest_second_time = @quest_time}
|
the 1st line is where i was having an issue... changed em all to eval anyways... it at least works now
the help file says only use %eval if you know you need to... how would i know? |
|
Last edited by Private on Wed Apr 14, 2010 12:17 pm; edited 1 time in total |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Apr 13, 2010 6:15 pm |
You should be able to get rid of "%eval" in every single one of those lines. Just leave the parentheses.
The way you know you need to use it is if you can't get it to work without %eval. But "((%secs - @quest_start_time) / 1000)" works fine. For mathematical equations, all you need to do is make sure the entire thing is inside parentheses.
Code: |
quest_time = ((%secs - @quest_start_time) / 1000)
#IF (@quest_time > 59) {
quest_minute_time = (@quest_time / 60)
quest_leftover_time = (@quest_minute_time * 60)
quest_second_time = (@quest_time - @quest_leftover_time)
} {quest_second_time = @quest_time}
|
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Wed Apr 14, 2010 5:12 am |
As Rahab said, I just want to say it in hopefully more succinct terms:
If you can use the expression without an error, you don't need %eval. If you get an error using an expression somewhere, you need %eval. |
|
|
|
Private Adept
Joined: 10 Jan 2002 Posts: 264 Location: USA
|
Posted: Wed Apr 14, 2010 12:16 pm |
Thanks Rahab you stated it perfectly...
i edited the alias, i'll give it a go in 25mins on next quest :P
wtf is succinct? hate going to google to look up uncommonly used words
(p.s. that was retorical, you dont need to boost your post count by replying) |
|
|
|
|
|