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
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Tue Apr 27, 2004 9:14 am
I have search but havent found a example that i (noob) understands,
is it possible too specify the chatwindow or even better a chatchannel (own made channel you /join) you accept a #EVENT from?
AND
is this doable? (at work so i cant test it)
Code: Select all
#chat tell
Sub main
/doevents
Sub Chat_Event(ChatType, Sender, Text)
/Tell ${Sender} Recived your message about ${Text}
/return
/endmacro
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Tue Apr 27, 2004 1:43 pm
Code: Select all
#chat tell
Sub Main
[color=green]:Loop[/color]
/doevents
[color=green]/goto :Loop[/color]
[color=red]/return[/color]
Sub Chat_Event(ChatType, Sender, Text)
[color=yellow]/Tell ${Sender} Recived your message about ${Text} [/color]
/return
[color=red]/endmacro [/color]
1) You want a loop here to keep checking for tells over and over. Otherwise the macro will run once and end. Not very productive.
2) Every sub needs a /return. This tells MQ to return to the sub that called the one currently running. In Sub Main this ends the macro... so get rid of the /endmacro line. It doesn't belong in white space anyway
3) This should work but this is gonna send that message to anyone who sends you a tell with no/little pause so unless you're known to be an incredibly fast typer you might want to add a check on who sent you that tell
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Tue Apr 27, 2004 1:49 pm
Thanks Preocts - great feedback
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Tue Apr 27, 2004 1:53 pm
Somtimes I luck out and sound like I understand this.
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Tue Apr 27, 2004 5:07 pm
hmm nothing happens. Very strange. Simply not getting into the Sub Chat_Event since i dont get the /echo. Nothing happens, macro just runs on when im giving it tells
Do i have to specifiy what window to look for the message? Not getting this plz help
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/goto :Loop
Sub Chat_Event (ChatType,Sender,ChatText)
/echo im inside
/tell ${Sender} repeating your message ${ChatText}
/return
/return
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Tue Apr 27, 2004 5:12 pm
For a quick explanation we'll call the space
inside the Sub /return lines code and the space
outside the Sub /return lines whitespace.
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/goto :Loop
Sub Chat_Event (ChatType,Sender,ChatText)
/echo im inside
/tell ${Sender} repeating your message ${ChatText}
/return
/return [color=red]<----- BOO[/color]
The way you have this written the entire Sub Chat_Event doesn't exist as a sub at all.
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/goto :Loop
[color=red]/return <---- YAY[/color]
|Each sub live in their own whitespace
Sub Chat_Event (ChatType,Sender,ChatText)
/echo im inside
/tell ${Sender} repeating your message ${ChatText}
/return
See the difference?
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Tue Apr 27, 2004 5:31 pm
omg so simple. Thanks again, you are my hero.
Didnt get any error msg so i went completly stunned.
Now i see the light (at least for the moment)

-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Tue Apr 27, 2004 5:46 pm
Ok i am blind, cant see whats wrong with this, same as before, nothing happens when i send a tell, not even /echo
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/goto :Loop
/return
Sub Chat_Event (ChatType, Sender, ChatText)
/echo im inside
/tell ${Sender} Recived your message about ${ChatText} in ${ChatType} form
/return
-
gameboy
- a lesser mummy

- Posts: 64
- Joined: Fri Nov 08, 2002 12:28 pm
Post
by gameboy » Tue Apr 27, 2004 6:01 pm
Try using Event_Chat instead of Chat_Event
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Wed Apr 28, 2004 8:40 am
Didnt work either....might be a completly different problem. Shall try a new approch after next release after patch....
-
Falco72
- a hill giant

- Posts: 215
- Joined: Fri Sep 26, 2003 3:24 am
Post
by Falco72 » Wed Apr 28, 2004 9:23 am
Try so:
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/delay 5
/goto :Loop
/endmacro
Sub Event_Chat(ChatType,Sender,ChatText)
/echo im inside
/tell "@Sender" Recived your message about "@ChatText" in @ChatType form
/return
Change @varname to ${varname} if you are using the new Var system.
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Wed Apr 28, 2004 1:31 pm
Code: Select all
#chat tell
Sub Main
:Loop
/doevents
/goto :Loop
/return
Sub [color=red]Event_Chat[/color] ([color=green]ChatType,Sender,ChatText[/color])
/echo im inside
/tell [color=yellow]${Sender}[/color] Recived your message about ${ChatText} in ${ChatType} form
/return
1) Question: Did you edit your copy of MQ before compiling to enable the new DataVars? The way you have this line now is correct but won't work by default until May 1st.
Now, as Falco72 suggests:
2) Events defined at the top of your macro with "#Event EventName" will always call a Sub called "Event_EventName". #Chat and timers are the two exceptions. They call one sub for all events that concern them.
3) MQ really really hates spaces that have no point. With the new TLO system this has relaxed a tiny bit but not much. No spaces between the parameters.
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Wed Apr 28, 2004 1:54 pm
Yes had the latest MQ2 zip
Yes had changed MQ2main.h for MQ2datavars. Working on other parts of the macro.
Have tried Event_Chat and Chat_Event, nothing happens
Have tried (Sender,.....) with and without spaces....
I dont have a clue whats wrong, looked at a bunch of other macros and mine is no different than theirs, at least not in my eyes.
Im waiting on next realese on MQ2 now hoping its a fluke and its working in that realese
-
Falco72
- a hill giant

- Posts: 215
- Joined: Fri Sep 26, 2003 3:24 am
Post
by Falco72 » Wed Apr 28, 2004 2:03 pm
Have you try this piece of code:
Code: Select all
Sub Main
:Loop
/doevents
[color=red]/delay 5[/color]
/goto :Loop
/endmacro
My events do NOT kick in if I dont put a /delay after the /doevents, even a zero delay works, like:
-
RudeBoy
- orc pawn

- Posts: 23
- Joined: Wed Mar 24, 2004 7:04 am
Post
by RudeBoy » Wed Apr 28, 2004 2:29 pm
no never had time before the patch, will try it as soon a new realese of MQ2 is out. Thanks for the tip :)