i think my $calc function is broke, or else im just a retard

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Shali
a ghoul
a ghoul
Posts: 87
Joined: Sun Dec 07, 2003 12:39 pm

i think my $calc function is broke, or else im just a retard

Post by Shali » Thu Dec 11, 2003 3:47 pm

this was entered in earlier, in Sub Main

Code: Select all

/declare y local
/varset y 1
and this was a /if command later in it, in a diff sub

Code: Select all

/if $calc((@y)+1)==2.00 /return success2
everytime i try to run it, i get "Ending Macro: calculate encountered unparseable text " " and then it lists the above line as being the faulty one, i have no clue why its not working, i checked other peoples $calc codes on here and they seemed to be following the same thing i did for mine, yet mine will not work[/code]

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Dec 11, 2003 3:49 pm

Try:

Code: Select all

/if [color=red]n[/color] $calc((@y)+1)==2.00 /return success2

Shali
a ghoul
a ghoul
Posts: 87
Joined: Sun Dec 07, 2003 12:39 pm

re

Post by Shali » Thu Dec 11, 2003 3:50 pm

i thought that might have been the error before, but i tried that as well, still returned the same error

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Dec 11, 2003 3:50 pm

Ok try the same thing but just comparing it to 2 instead of 2.00.

Not at home right now so I can't actually test. :(

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Dec 11, 2003 3:53 pm

Also there probably isn't a reason you need this extra set of parenthesis either is there?

Code: Select all

/if n $calc(@y+1)==2 /return success2
:shock: doh.. just realized you have y declared as a local variable. Try changing it to global if you are trying to use it in other subs.

Shali
a ghoul
a ghoul
Posts: 87
Joined: Sun Dec 07, 2003 12:39 pm

re

Post by Shali » Thu Dec 11, 2003 3:57 pm

lol woot, ya it was the parenthesis and global thing, i didnt really know what global meant, thought it had to do with local to ur pc or something involving servers for global, didnt know it was in reference to diff subroutines

those 2 things fixed the prob, n may have been the prob too, thanks for the help :D :D :D

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Dec 11, 2003 3:59 pm

No prob. The n and global was most likely the fix. The parenthesis would probably have worked as is.