Need Help With Parsing Events

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

lambda
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Oct 14, 2004 8:30 pm

Need Help With Parsing Events

Post by lambda » Thu Oct 28, 2004 3:42 pm

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?"

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 28, 2004 3:46 pm

${Math.Calc[${Mystring}+5]} should work if the string contains a number.

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Oct 28, 2004 3:50 pm

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.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

lambda
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Oct 14, 2004 8:30 pm

Post by lambda » Thu Oct 28, 2004 3:54 pm

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?"

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Thu Oct 28, 2004 4:00 pm

ahhh, good idea.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

Jerle69
a hill giant
a hill giant
Posts: 263
Joined: Wed Apr 28, 2004 3:26 pm

Post by Jerle69 » Thu Oct 28, 2004 5:03 pm

${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.
--Jerle

lambda
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Oct 14, 2004 8:30 pm

Post by lambda » Thu Oct 28, 2004 7:20 pm

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?"

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Fri Oct 29, 2004 2:03 am

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.

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Fri Oct 29, 2004 2:21 am

Search around, there are plenty of macros that give examples of how to take/give specific ammounts of cash.

lambda
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Oct 14, 2004 8:30 pm

Post by lambda » Fri Oct 29, 2004 4:45 pm

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?"

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Fri Oct 29, 2004 5:03 pm

you need to /doevents:

Code: Select all

:waitforhail 
/doevents
/delay 1
/goto :waitforhail 

lambda
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Oct 14, 2004 8:30 pm

Post by lambda » Fri Oct 29, 2004 5:05 pm

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!

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Fri Oct 29, 2004 5:15 pm

:)