Code: Select all
/macro macro "option1=value1 option2=value2 option3=value3" "Some other parameter" "yet a parameter"Code: Select all
/varset l1 1
:Options
|** Tried to check for end of options here, to avoid a destop crash, but seems to be a problem with the $arg() **|
/if "$arg($l1,"$p0")"=="" /goto :EndOptions
|** Find the optionname of the string **|
/varset l3 $left($instr("=","$arg($l1,"$p0")"),"$arg($l1,"$p0")")
|** Find the value for the option **|
/varset l4 $right($calc($strlen("$arg($l1,"$p0")")-$instr("=","$arg($l1,"$p0")")-1),$arg($l1,"$p0"))
|** Assign values to their corresponding options **|
/varset $l3 $l4
/varadd l1 1
/if "$arg($l1,"$p0")"!="" /goto :Options
:EndOptionsI tried working with simple /echo'ing directly from the EQ client, but this also crashed the client.
My question is, have I made some fatal, stupid, "Let me suck up all the memory due to a an endless loop" code, or something completely different? Or is the $arg() just FUBARed?
The problem comes not when it actually finds the split, but when it doesnt.
This is a working example:
Code: Select all
/echo Arg-test: $arg(2,"This is a string.")Code: Select all
/echo Arg-test: $arg(5,"This is a string.")How am I to know how many arguments (read: space seperated words) I have in my string? Cause as it is, this is the only way to avoid this crash, to simply not try and access a non-existing argument.

