Ineffective Custom Events (solved, read edit note)

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

Vayeco Dynn
a ghoul
a ghoul
Posts: 113
Joined: Wed Aug 25, 2004 3:00 am

Ineffective Custom Events (solved, read edit note)

Post by Vayeco Dynn » Wed Aug 25, 2004 2:47 pm

Edit: My apologies, I misinterpreted the language structure, the below is left for reference only. (Though please do read the bolded suggestion in my following post)

I'm having a huge problem with custom events. The match system is too general, and it is causing limitations. If some sort of regex type system was incorporated, this problem would be solved.

For example:

Code: Select all

#event UnderAttack     "#1#YOU for #*#" 

Sub Event_UnderAttack

   /echo ${Param0} is attacking us!

/return
Upon "A black bear mauls YOU for 8 points of damage." the following is returned:
[MQ2] A black bear mauls YOU for 8 points of damage. is attacking us!
What was actually desired was this (and why it wasn't outputted is beyond me):
[MQ2] A black bear mauls is attacking us!
Now it would be really great if the pattern recognition was so advanced that we could get it down to:
[MQ2] A black bear is attacking us!
See where I'm going with this?

Thanks for your time.
Last edited by Vayeco Dynn on Wed Aug 25, 2004 5:29 pm, edited 2 times in total.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Aug 25, 2004 2:51 pm

This is BUG reports, not help.

Please post your help for macros in the appropriate forum to avoid being flamed like a marshmallow thrown into a bonfire.

Your question can be answered, and I will tell you to look for .MID as well as .Left and .Right, as I believe they hold the answers. RTFM.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Caladine
a hill giant
a hill giant
Posts: 164
Joined: Fri Feb 13, 2004 9:29 pm

Post by Caladine » Wed Aug 25, 2004 3:15 pm

Just because this is a very simple thing that could have been avoided...
Now I don't mean to be rude, but this is incredibly frustrating to see every day. (and frankly, not doing the following is more rude)

READ THE FUCKING MANUAL
The Fucking Manual wrote:Custom Events

The new Custom Event system requires that you use the entire line of chat, BUT allows for making sections of the line a parameter.


Old Event system
#Event SelfEcho "[MQ2] Genbot "

Here is what the new Event look like:
#Event SelfEcho "[MQ2] Genbot #1#"
The #1# in the middle of the match text is what you use to indicate "this part of the message should be given to me in a parameter".
The number between the # signs says what parameter number you want this to be in your Sub Event_Whatever.

The first parameter in the sub will be the entire line itself... 1 starts AFTER that. e.g. this event could look like this:

Sub Event_SelfEcho(string Line, string Command)

Imagine this is the text that matches the event text:

"[MQ2] Genbot THIS IS MY COMMAND"

The two parameters are:

Line=[MQ2] Genbot THIS IS MY COMMAND
Command=THIS IS MY COMMAND
Now I'll be nice and give you what you should have written (and would have if you'd read this part).

Code: Select all

#event UnderAttack     "#1#YOU for #*#" 

Sub Event_UnderAttack(string line, string mob) 

   /echo ${mob} is attacking us! 

/return
Here's a breakdown of how this works:
That #1# you have corresponds to param 1 on the Sub Event line there, where the actual line you get from the event is param 0.

So:

Code: Select all

#event omgstuff "#1# this stuff #2# is simple #3#"
Has 4 parsed params to pass to your event sub - the whole line recieved and the 3 you want specifically.

Code: Select all

sub Event_omgstuff(string line, string param1, string param2, string param3)
is how you get those three things you want.
Now, those names can be anything you want, just showing how they correspond.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Aug 25, 2004 4:02 pm

I was thinking of doing it another way, but params do work.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Caladine
a hill giant
a hill giant
Posts: 164
Joined: Fri Feb 13, 2004 9:29 pm

Post by Caladine » Wed Aug 25, 2004 4:35 pm

/nod aChallenged1

My post was directed at the thread poster, so don't take any offense from my post. Your way would work also, you'd just have to have the macro parse the string for the items you wanted (which you could do with left, mid, right, etc). I figure why reinvent the wheel when vanilla MQ2 will do it for you. :D

Vayeco Dynn
a ghoul
a ghoul
Posts: 113
Joined: Wed Aug 25, 2004 3:00 am

Post by Vayeco Dynn » Wed Aug 25, 2004 5:25 pm

Caladine wrote:READ THE FUCKING MANUAL
Why thank you, I didn't realize they even had a manual for this whacky program omgz0r!

Actually, I read that several times.

I'm sorry though, I was thinking in a wierd programming way... I was assuming #1# would be assigned to Param0 and #2# to Param1 etc. If you do something like the following...

Code: Select all

/call SomeSub Whee!

sub SomeSub
/echo ${Param0} | Returns "Whee!"
/return
And I applied that logic to the Event_ sub structure.

Thanks aChallenged, that should help me for more complex searches, I didn't realize those commands existed. I would suggest that they reference that in the manual by custom events. (bolded in case any dev happens to come upon this).

And Caladine, thanks for clearing that up (though I can't stand the flaming here). It was a small mixup of programming logic... But I guess I can understand where you're coming, assuming that a lot of whiney babies probably come here asking for prepackaged wonder macros.

Caladine
a hill giant
a hill giant
Posts: 164
Joined: Fri Feb 13, 2004 9:29 pm

Post by Caladine » Wed Aug 25, 2004 5:48 pm

And Caladine, thanks for clearing that up (though I can't stand the flaming here). It was a small mixup of programming logic... But I guess I can understand where you're coming, assuming that a lot of whiney babies probably come here asking for prepackaged wonder macros.
Sorry to jump down your throat like that, but yeah, we get waaaay to many people wanting prepackaged wonder macros. 95% of them don't bother to check the manual (which cleans things up pretty well most of the time, but it isn't perfect) so we get pretty uppity about it. This is especially true with the flood of l33t hax0rZ coming from rpgexpert looking for afk macros and active hacks. :x

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Wed Aug 25, 2004 6:22 pm

Thanks aChallenged, that should help me for more complex searches, I didn't realize those commands existed. I would suggest that they reference that in the manual by custom events. (bolded in case any dev happens to come upon this).
I would be opposed to this on principle. If you referenced every type in every instance it could possibly be used the manual may be easier to figure out a subject (if you could find the subject), but you would have the information printed 100's of times repeatedly and just be a royal mess.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Wed Aug 25, 2004 6:48 pm

Caladine wrote:95% of them don't bother to check the manual (which cleans things up pretty well most of the time, but it isn't perfect)...
If there is something in the readme that needs to be written more clearly or if there are typos, feel free to PM me so the readme can be 'perfect'.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Aug 25, 2004 7:28 pm

I believe there is a bug with using #1# at the beginning of a line but I haven't had a chance to track it down yet.

#event YouSay "#*#You say, '#1#'" fires twice
#event YouSay "You say, '#1#'" does not

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Wed Aug 25, 2004 7:40 pm

I recently had a bit of trouble writing custom events to catch tells in other languages/cross server tells. It would not catch any line that had multiple ' in it using the syntax DKAA just posted. I ended up capturing the entire line and stripping off the final ' with string commands to make everything work nicely. See the genbot 13.3.2 thread for the final bit I ended up with.

Note: This has nothing to do with the bug DKAA is talking about, just some behavior I've noticed and had the pleasure of running into.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Aug 25, 2004 8:09 pm

Not everything is in the manual, nor should it be. This is a stand I agree with, though at times it hinders me. If it is so simple anyone could do it, then everyone would be and that would just be bad news.

The FM is good to a point, it is not a guide to the universe of macroing. The forums are a great place to learn, because you can see usage, and rip and paste as your heart desires and test your theories out.
Communicating your problems in the proper forums, threads, and with reasonable details, including the macro or plugin if not already posted within the same thread, are the finaly way to gain insight.

Flamage is almost 100% due to a few things, let's count them off...
1) The manual, also known as the Fucking Manual or FM for short. If you don't Read The Fucking Manual, or at least show that you have but don't quite understand what you found, you are pretty much open game for flamage. There is even a sticky post that says as much.

2) Search feature, it does work. Before using it though, I suggest looking at the entire search page and see what options there are. Some options are better for one type of search than others. Failure to use the search function will also lead to flamage, and again there is as sticky post about that, the same one as before.

3) Asking for active hacks and macros for AFKing. MQ is a great thing. And like all great things, too much of a great thing is not good. If too many people use MQ it will be noticed. Mostly it will be the idiots and morons who aren't smart enough to create their own macros, or modify/rip others to suit their needs without creating a monster that screams "BAN MY STUPID FUCKING ASS, I'M USING A THIRD PARTY TOOL!"

There are others, but that covers it pretty well.

Uf you have legitimate questions, ask, but try to do some research first. If possible, or reasonably pertinate to your post, link what you found that looks like something you're needing help with. That at least shows you have looked into it some but are now at a stopping point and need further guidance.

Oh, I forgot, the ULTIMATE assurance of Bonfire sized flamage is the old "MQ2 doesn't work all of a sudden, wtf, why is it broken" right after a patch. If you're so stupid that you never even open up the readme or help files associated with a program then you deserve to have your ass flamed and then some. One idiot here, have not seen a post by him in a few weeks now, ended up with a "rank" of Chicken Little for his posts of doom and gloom.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!