Page 1 of 2

Macro code related CTD

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

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;

Posted: Sat Sep 04, 2004 8:23 am
by Cr4zyb4rd
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.

Posted: Sat Sep 04, 2004 8:27 am
by Meydrel'Koth
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.

Posted: Sat Sep 04, 2004 2:25 pm
by dont_know_at_all
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.

Posted: Sat Sep 04, 2004 2:41 pm
by hytiek
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

Posted: Sat Sep 04, 2004 3:02 pm
by Cr4zyb4rd
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.

Posted: Sat Sep 04, 2004 3:14 pm
by Fippy
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.

Posted: Sat Sep 04, 2004 3:19 pm
by Cr4zyb4rd
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.

Posted: Sat Sep 04, 2004 6:45 pm
by Meydrel'Koth
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

Posted: Sat Sep 04, 2004 6:57 pm
by Meydrel'Koth
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.

Posted: Sat Sep 04, 2004 8:21 pm
by Cr4zyb4rd
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.

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

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

Posted: Sun Sep 05, 2004 9:48 am
by z-roice
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

Posted: Sun Sep 05, 2004 10:16 am
by Cr4zyb4rd
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.

Posted: Sun Sep 05, 2004 10:24 am
by z-roice
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]