Page 1 of 1

Need Help With Parsing Events

Posted: Thu Oct 28, 2004 3:42 pm
by lambda
I am in the process of writing a macro, and ran into a problem. I have searched this board for information pertaining to it, as well as the manual. So far I have not been able to find anything that helps to fix my problem.

What I want to do is to take an event such as:
#Event myEvent "SomeName says, #1#"
Where #1# is an Int,
What the problem that I am running into is, how do you convert the string into an Int so that I could possably do some calculations on it.

A most gracious macro writer,
lambda
or (should give away who I am on another board)
"Quis Custodiet Ipsos Custodes?"

Posted: Thu Oct 28, 2004 3:46 pm
by blueninja
${Math.Calc[${Mystring}+5]} should work if the string contains a number.

Posted: Thu Oct 28, 2004 3:50 pm
by fearless
casino macro?

It's the only thing I can think of where you would need to evaluate numbers and do a math calc on it.

Posted: Thu Oct 28, 2004 3:54 pm
by lambda
LOL... I thought people would think it was a casino macro, but it isn't, I am using for my guild as a bank. What it will do is pass out money to guild members based on how much they tell my char to. Of course it will have a list of guild members so that it doesn't start passing out money to random people. The reason I am doing this is because it is a pain to constantly have to get people together inorder to pass items of money to eachother. This will make it alot easier. By the way, thank you for your quick replies!

Macro Writer,
lambda
"Quis Custodiet Ipsos Custodes?"

Posted: Thu Oct 28, 2004 4:00 pm
by fearless
ahhh, good idea.

Posted: Thu Oct 28, 2004 5:03 pm
by Jerle69
${Math.Calc[]} automatically casts all operators into strings, performs the operations, then returns the appropriate datatype automagically. You can stick ints, floats, numbers as strings, whatever you want in there.

Posted: Thu Oct 28, 2004 7:20 pm
by lambda
I am now running into a second problem. This one doesn't have to do with events, but with the macro I am writing. Lets say a guild member asks for 1k plat, how do I give him this amount? I could either give him 1pp with "/ctrl /notify Inventory IW_Money0 leftmouseup" or I could give him everything with "/shift /notify Inventory IW_Money0 leftmouseup". But is there a way to give him the specified 1k?

Macro Writer,
Lambda

"Quis Custodiet Ipsos Custodes?"

Posted: Fri Oct 29, 2004 2:03 am
by Chill
prolly need to: "/notify Inventory IW_Money0 leftmouseup", /notify the plat box leftmouseup, /keypress some numbers, and /notify the ok box leftmouseup.

can use /window to get the exact element names, or look them up in TFM.

Posted: Fri Oct 29, 2004 2:21 am
by Cr4zyb4rd
Search around, there are plenty of macros that give examples of how to take/give specific ammounts of cash.

Posted: Fri Oct 29, 2004 4:45 pm
by lambda
Yeah, I found it right after I posted. But just as I got that to work, I a back to almost my original problem with events. I have code like this:

Code: Select all

#event hail "#1# says, Hail #2#"

Sub Main
/echo Macro Started
:waitforhail
/goto :waitforhail
/return

Sub Event_hail(hailText, theirName, myName)
/echo Somebody said Hail!
/return
The problem is that it never reaches the Event_hail even after I or anybody hails me.... Why is this? I have hit a wall, and without event functionality, I wont be able to break through. I would appreciate your help.

Macro Writer,
lambda

"Quis Custodiet Ipsos Custodes?"

Posted: Fri Oct 29, 2004 5:03 pm
by Chill
you need to /doevents:

Code: Select all

:waitforhail 
/doevents
/delay 1
/goto :waitforhail 

Posted: Fri Oct 29, 2004 5:05 pm
by lambda
Hmmm...Maybe I found the answer, but am not sure because I am not at home at the moment. But I think that in my loop, I might need to have a /doevents. Is this the answer to my problem?

Macro Writer,
lambda

"Quis Custodiet Ipsos Custodes?"

Edited:
Well, while I was writing this the answer was posted! So thank you very much!

Posted: Fri Oct 29, 2004 5:15 pm
by Cr4zyb4rd
:)