Before I start, let me say I was using MQ2-20040512a compiled with VS6 SP6.
Last night I was augmenting my RH script and tried to take advantage of the new #event system. Using Lax's examples (I wanted to acheive exactly what he demonstrated, actually), I didn't get the results I anticpated?
A snippit from the macro looked like this (included a little debug /echo so I could see what was going on)...
Code: Select all
#Event TogLeash "[MQ2] Leash #1#"
|
| ... some declares here with global doLeash and stake variables...
|
Code: Select all
Sub Event_TogLeash(string Line, string Command)
/if (${Command.Equal[OFF]} || (${Int[${Command}]}<0)) {
/varset doLeash FALSE
/echo ** Leashing is now OFF!
} else {
/varset doLeash TRUE
/varset leashlength ${Int[${Command}]}
/varset stakeX ${Me.X}
/varset stakeY ${Me.Y}
/echo ** Leashing is now ON! Leashlength: ${leashlength} ft.
/echo ** Stake planted at X:${stakeX}, Y:${stakeY}
}
|- This not working?! WTF?
/echo Line: "${Line}" & Command: "${Command}"
/return
** Leashing is now ON! Leashlength: 0 ft.
** Stake planted at X:45, Y:-23
Line: [MQ] Leash 400 & Command: "NULL"
I just sighed and went "BLAH, that's odd" Seems to me that it didn't paramaterize the event arguments as advertised. I just went ahead and rewrote it like this, which works but is less graceful and doesn't use any of the new #event stuff =(
Code: Select all
#Event TogLeash "[MQ2] Leash#*#"
|
| ... some declares here with global doLeash and stake variables...
|
Code: Select all
Sub Event_TogLeash(string Line)
/if (${Line.Arg[3].Equal[OFF]} || (${Int[${Line.Arg[3]}]}<0)) {
/varset doLeash FALSE
/echo ** Leashing is now OFF!
} else {
/varset doLeash TRUE
/varset leashlength ${Int[${Line.Arg[3]}]}
/varset stakeX ${Me.X}
/varset stakeY ${Me.Y}
/echo ** Leashing is now ON! Leashlength: ${leashlength} ft.
/echo ** Stake planted at X:${stakeX}, Y:${stakeY}
}
/return
Thanks,


