Macro code related CTD

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

Moderator: MacroQuest Developers

Meydrel'Koth
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Sep 02, 2004 4:04 pm

Macro code related CTD

Post by Meydrel'Koth » Sat Sep 04, 2004 7:42 am

Code: Select all

#event ResendTell "#1# tells you, '#2#'"

Sub Event_ResendTell (Line, TellFrom, Message)
  |Sends the Tell to the Group Channel so the leader can see it
  /gsay ${TellFrom} to ${Me}, '${Message}'
/return
When this code is comented out, the rest of the code runs, but if i leave it in, I CTD every time.

I'm fairly new to MQ2, but I am not new to programming. I just spent 2 hours in the manual, and another hour looking over this forum... I cant figure out whats wrong with this.

Thanks in advance
-MK

Debug info follows:

Spew:
[MQ2]Macro - Starting macro with '/call Main'
[MQ2]Call - Calling subroutine Main with params
[MQ2]Echo - [MQ2] camping
First-chance exception at 0x03025c56 (MQ2Main.dll) in eqgame.exe: 0xC0000005: Access violation reading location 0x00000018.

Call stack:

> MQ2Main.dll!Blech::Chew(BlechNode * pNode=0x016cfdd8, char * Input=0x0012aeb8) Line 888 C++
MQ2Main.dll!Blech::Feed(char * Input=0x0012aeb8) Line 444 + 0x1c C++
MQ2Main.dll!CheckChatForEvent(char * szMsg=) Line 672 C++
MQ2Main.dll!WriteChatColor(char * Line=, unsigned long Color=, unsigned long Filter=) Line 247 C++
MQ2Main.dll!Echo(EQData::_SPAWNINFO * pChar=, char * szLine=) Line 412 + 0x11 C++
MQ2Main.dll!HideDoCommand(EQData::_SPAWNINFO * pChar=, char * szLine=, int delayed=) Line 120 + 0x16 C++
MQ2Main.dll!DoNextCommand() Line 57 C++
MQ2Main.dll!Heartbeat() Line 296 + 0x5 C++
MQ2Main.dll!Detour_ProcessGameEvents() Line 311 C++
eqgame.exe!00496435()



Code where the crash occurred

Code: Select all

feedernomatch:
			// NO MATCH

			// continue walking tree
			if (pNode->pNext)
			{
				// position remains the same
				Peek();
				pNode=pNode->pNext;
			}
			else
			{
				// Pos goes down a level - dont reprocess the same child
				Pop();
				while(1)
				{
>>					if (pNode->pNext)
					{
						pNode=pNode->pNext;
						break;
					}
					if (PLP)
					{
						Pop();
					}
					else
					{
						pNode=0;
						break;
					}
				}
			}
			CurrentPos.pNode=pNode;
		}
		return Count;
Disassembly

Code: Select all

				// Pos goes down a level - dont reprocess the same child
				Pop();
03025C49  dec         bl   
03025C4B  movzx       edx,bl 
03025C4E  mov         esi,dword ptr [esp+edx*8+30h] 
03025C52  mov         eax,dword ptr [esp+edx*8+34h] 
				while(1)
				{
					if (pNode->pNext)
>>>>03025C56  mov         ecx,dword ptr [eax+18h] 
03025C59  test        ecx,ecx 
03025C5B  jne         feedernomatch+47h (3025C78h) 
03025C5D  lea         ecx,[ecx] 
					}
					if (PLP)
03025C60  test        bl,bl 
03025C62  je          feedernomatch+4Ch (3025C7Dh) 
					{
						Pop();
03025C64  dec         bl   
03025C66  movzx       eax,bl 
03025C69  mov         esi,dword ptr [esp+eax*8+30h] 
03025C6D  mov         eax,dword ptr [esp+eax*8+34h] 
03025C71  mov         ecx,dword ptr [eax+18h] 
03025C74  test        ecx,ecx 
03025C76  je          feedernomatch+2Fh (3025C60h) 
					{
						pNode=pNode->pNext;
Last edited by Meydrel'Koth on Sat Sep 04, 2004 9:13 am, edited 2 times in total.

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

Post by Cr4zyb4rd » Sat Sep 04, 2004 8:23 am

If you really spent 2 hours RTFM, it's pretty amazing you didn't come across a section telling you the proper way to report CTD problems.

Meydrel'Koth
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Sep 02, 2004 4:04 pm

Post by Meydrel'Koth » Sat Sep 04, 2004 8:27 am

I didnt think a debug was relevant because i have nailed down the section of code that is causeing the problem. Its posted there now.

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 » Sat Sep 04, 2004 2:25 pm

Cr4zyb4rd, why the fuck are you flaming someone who is actively debugging a problem? If it's good debug data, I don't care if they post it to the outdated macro forum.

hytiek
Contributing Member
Contributing Member
Posts: 54
Joined: Mon Jun 14, 2004 5:45 pm

Post by hytiek » Sat Sep 04, 2004 2:41 pm

My initial comment is based on spacing of the Sub ...

Code: Select all

Sub Event_ResendTell (Line, TellFrom, Message)
shouldn't that be

Code: Select all

Sub Event_ResendTell(Line, TellFrom, Message)
In all of the TFM that I've read, all of the macros and plugins, I've never seen a space trailing the Sub name, the (XYZ, ABC) parm's always are attached to the back of the sub routine name. Give it a shot; and hey, free advice is free advice. The only other thing I can imagine is if the string has a comma in it, something to check out.


-hytiek

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

Post by Cr4zyb4rd » Sat Sep 04, 2004 3:02 pm

Cr4zyb4rd, why the fuck are you flaming someone who is actively debugging a problem? If it's good debug data, I don't care if they post it to the outdated macro forum.
DKAA why the fuck are you flaming ME without looking at timestamps? The top post has been edited at least three times from its original "How come my macro don't work?!?" state since I replied.

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Sat Sep 04, 2004 3:14 pm

Dont ya hate it when people go back and edit a post that makes following posts make no sense. i always try to quote the thing I am responding too so no mater what they edit afterwards I still have there dumbness quoted in my reply.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

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

Post by Cr4zyb4rd » Sat Sep 04, 2004 3:19 pm

It wasn't totally dumb, and I wasn't trying to insult anybody, it just didn't offer a lot to go on. I realize a lot of people "just want their macro to work right", and that's cool. My own philosophical position though is that CTDs triggered by MQ macros just sholdn't happen, and should be hunted down and slain wherever possible. If i'd known the quickfix so I could say "please post a dump if you can, but in the meantime use XYZ" I would have done so, but taking the long view I want the source to be as generally foolproof and crash-free as possible.

Meydrel'Koth
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Sep 02, 2004 4:04 pm

Post by Meydrel'Koth » Sat Sep 04, 2004 6:45 pm

Took the space out, it still fails.

However through more trial and error, i have found that its the #2# that is causeing my error.

this works:

Code: Select all

#event ResendTell "tells you, '#1#'"
Sub Event_ResendTell(Line, Message)
/return
this does not:

Code: Select all

#event ResendTell "#1# tells you, '#2#'"
Sub Event_ResendTell(Line, TellFrom, Message)
/return

Meydrel'Koth
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Sep 02, 2004 4:04 pm

Post by Meydrel'Koth » Sat Sep 04, 2004 6:57 pm

a little more troubleshooting:

This also does not work

Code: Select all

#event ResendTell "#*# tells you, '#*#'"
Sub Event_ResendTell(Line)
/return

so it looks like its haveing problems with 2 variables in the event line.

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

Post by Cr4zyb4rd » Sat Sep 04, 2004 8:21 pm

Try it without the "wrapper" quotes. From the debug it looks like the problem is in parsing your macro, not the macro itself, if that makes any sense.

Also, out of curiosity, see if it still CTDs if you take out the comma (yeah I know the event won't work without it). I can't get ingame right this moment or i'd single-step though the parse myself.

Meydrel'Koth
decaying skeleton
decaying skeleton
Posts: 7
Joined: Thu Sep 02, 2004 4:04 pm

Post by Meydrel'Koth » Sun Sep 05, 2004 6:17 am

Code: Select all

#event ResendTell "#1# tells you,  #2#"
CTD

Code: Select all

#event ResendTell "#1# tells you #2#"
CTD

Code: Select all

#event ResendTell #1# tells you #2#
CTD

z-roice
a lesser mummy
a lesser mummy
Posts: 62
Joined: Sun Aug 08, 2004 5:25 am

Post by z-roice » Sun Sep 05, 2004 9:48 am

I had exactly the same problem..

i was using "|${Target.CleanName}| has become ENRAGED!"

and a few other lines as that with a variable as first parameter.

After trying a bit around i found out you have to :

1.

always have a #*# before the variable u parsing if it is the first word of the line.. like this:

"#*#|${Target.CleanName}| has become ENRAGED!"

2.

AND (important for npcs)

"#*##1# has become ENRAGED!" will only react to single words for #1#

to have it react on multiword stuff too you have to use it that way:

"#*##1#has become ENRAGED!" and cut off the last space inside
your event Sub. Without that change it wouldnt react on for example: "Visionary of Glory"

---------------------------------

Hope this helps if you still need it.

peace

Z-Ro

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

Post by Cr4zyb4rd » Sun Sep 05, 2004 10:16 am

None of that seems at all right to me, but I'm in no big hurry to start diving into the Blech code to figure out what's going on.

#event Foo "#*##1# some text"

doesn't make much sense because the first #*# has no idea how much to glob, although I guess #1# returning only a single word makes as much sense as anything, but I haven't been paying enough attention to the various threads (there's a TON with "how do i get such and such trigger to work" stuff in them, as I'm sure you know) to know what the behavior's supposed to be. I'm 99% sure that what you're doing shouldn't be causing a CTD though, and I'll try to bring it to Lax's attention if he doesn't find it first. Maybe adding a bit more documentation on what/how those searches grab wouldn't be out of line.

edit: In the meanwhile, it shouldn't be too hard to just get the bare-minimum required to fire your trigger, and then dice up the text manually with ${String.Whatever} type moves.

z-roice
a lesser mummy
a lesser mummy
Posts: 62
Joined: Sun Aug 08, 2004 5:25 am

Post by z-roice » Sun Sep 05, 2004 10:24 am

i know it doesnt make sense to put that #*# at front but it indeed helped (Me at least)

here are my chat triggers


#Chat say
#Chat tell

Code: Select all

#Event ChatTrigger				"#*##1# tells the #2#,  '#3#'"
#Event ChatTrigger				"#*##1# tells the #2#, '#3#'"
#Event ChatChannelTrigger		"#*##1# tells #2#:#3#, '#4#'"
since players only have 1 name displayed you can use it w/o wrapping it together to also filter multiple word names.

It works - dont ask me why

Note: the 1st ChatTrigger Event only reacts to raid, the 2nd to guild and group. For normal tells just use the #chat tell event[/code]