Error with Events, numerical parses.

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

Moderator: MacroQuest Developers

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

Post by Cr4zyb4rd » Sun Aug 15, 2004 7:45 pm

Yes...I just pasted the code to do it..look up :P

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Sun Aug 15, 2004 7:51 pm

This gives me an idea how to fix the array problem.

Code: Select all

Sub ItemSub
   /for LC 0 to @DAS
   /if (${Cursor.Name.Find[@DA(@LC)]}) {
      /drop
      /return
   }
   /if (@LC==@DAS) {
      /autoinv
      /return
   }
   /next LC
/return 
It's where I first saw arrays.. it's old syntax but doesn't really matter, because /for still exists.

/cheers something new to work on.

I'll start writing out rough drafts for this /for (which won't work for at least an hour). So eta on more 1 hour ;)

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Sun Aug 15, 2004 7:54 pm

Ah hmm.. I jumped the gun.. just read "does this work?" and assumed it didn't, so started RTFM again and doing testing. Inc leet macro one sec please ;)

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Sun Aug 15, 2004 8:43 pm

Here it is.

Code: Select all

Sub Event_StartCast

/call Reset

/declare index int local

/for index 1 to ${CastMez.Size}
	/if (${CastMez[${index}].Equal[${Param1}]}) {
		/docommand /${CT} Casting Mezz on ${If[${Target.CleanName.Left[1].Equal[#]},${Target.CleanName.Right[-1]},${Target.CleanName}]}.
		/varset LastSpell Mezz
		/varset ResistVar 1
		}
/next index

/for index 1 to ${CastBuff.Size}
	/if (${CastBuff[${index}].Equal[${Param1}]}) {
		/docommand /${CT} Casting ${Param1} on ${If[${Target.CleanName.Left[1].Equal[#]},${Target.CleanName.Right[-1]},${Target.CleanName}]}.
		/call Reset
		}
/next index

/for index 1 to ${CastSlow.Size}
	/if (${CastSlow[${index}].Equal[${Param1}]}) {
		/docommand /${CT} Casting Slow on ${If[${Target.CleanName.Left[1].Equal[#]},${Target.CleanName.Right[-1]},${Target.CleanName}]}.
		/varset LastSpell Slow
		/varset ResistVar 1
		}
/next index

/return

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 » Mon Aug 16, 2004 3:51 pm

Wouldn't Param1 in the case of an event sub be the whole line that triggered the event and Param2 be what you're looking for? From what I remember the first param to an event sub is the whole line and after that the ones you define with #x#.

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 » Mon Aug 16, 2004 5:42 pm

blueninja wrote:Wouldn't Param1 in the case of an event sub be the whole line that triggered the event and Param2 be what you're looking for? From what I remember the first param to an event sub is the whole line and after that the ones you define with #x#.
Sub Event_Chat[(ChatType,Sender,ChatText)]

ChatType : Channel of message (tell, group, say)
Sender : Name of the person who sent the message
ChatText : Text they sent
If you just use Sub Event_Chat:

Param0=ChatType
Param1=Sender
Param2=ChatText

However, for a strictly custom Sub:
Sub Event_SelfEcho(string Line, string Command)
If You use just Sub Event_SelfEcho

Param0=Line
Param1=Command

At least that is how it should work.

Param0 is always the first parameter passed in if you do not use ()

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Mon Aug 16, 2004 8:25 pm

ATM this Sub_Event has problems, so I think I will be doing:

Code: Select all

Sub Event_StartCast(string Line, string SC)
Unless it's something else causing it to not work.