Feature Request: String concatenation or globbing capability

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Feature Request: String concatenation or globbing capability

Post by GoatFoot » Sun Jan 19, 2003 3:06 am

$p0 = "a gibbering coder implodes for 7,261,988 points of damage"

I wish to extract the mob's name - "a gibbering coder".

$left(17,"$p0") returns a gibbering coder

/varset l0 $left(17,"$p0") sets l0 to "a" because of the embedded white spaces.

This works.

Code: Select all

sub event_pyschotic
	/varset l0 2
	:loop_find_critter_name
		/varadd l0 1
	/if $arg($l0,"$p0")!=for /goto :loop_find_critter_name
	/varsub l0 1
	/for l1 1 to $l0
		/varset a(1,$l1) $arg($l1,"$p0")
	/next l1
	/varset l2 "$a(1,1) $a(1,2) $a(1,3) $a(1,4) $a(1,5)"
	/echo $l2
	/for l2 1 to 5
		/varset a(1,$l2) ""
	/next l2
/return
The above is ugly.

For the record, this appears to consistently blow up

Code: Select all

/for l1 1 to l0
    /varset l2 "$l2 $a(1,$l1)"
/next l1
Blows up on local and global vars. MQ does not like to assign a var to itself. :)

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sun Jan 19, 2003 4:44 am

GoatFoot wrote:/varset l0 $left(17,"$p0") sets l0 to "a" because of the embedded white spaces.
too tired to decipher your other code snippets... wouldn't:

/varset l0 "$left(17,"$p0")"

work, or does it get muddled on the nested quotations?