Need another set of eyes on this one.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Need another set of eyes on this one.

Post by Preocts » Wed Apr 28, 2004 3:15 pm

Code: Select all

| Assume called with ${Param0} == "Destroy;Rusty Dagger"
Sub HandleCursor
  | Sub HandleCursor (Command;ItemName)
  | Does a given command with a given item if and only if that item is currently on the cursor.
  | Commands:  Destroy -- will destroy item
  |            Loot    -- will loot item
[color=red]  /echo ${Param0}
  /echo ${Param0.Arg[2,;]}[/color]
  /if (!${Param0.Arg[2,;].Length}) /return
  /if (${Cursor.Name.NotEqual[${Param0.Arg[2,;]}]}) /return
  /if (${Param0.Arg[1,;].Equal["Destroy"]} && ${Cursor.Name.Equal[${Param0.Arg[2,;]}]}) /destroy
  /if (${Param0.Arg[1,;].Equal["Loot"]} && ${Cursor.Name.Equal[${Param0.Arg[2,;]}]}) /autoinventory
  /delay 3
/return
This is more of a confusion on the String.Arg[] usage. Taking a look at my /echo lines I would expect the following output:
[MQ] Destroy;Rusty Dagger
[MQ] Rusty Dagger

But I'm getting:
[MQ] Destroy;Rusty Dagger
[MQ] Rusty

Am I using ${Param0.Arg[2,;] wrong?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Apr 28, 2004 4:07 pm

Looks to me like Lax has it look for space *and* your optional seperator if provided and it should be.. look for space *or* your optional seperator if provided.

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Wed Apr 28, 2004 4:10 pm

There appears to be a bug in GetArg, the code relating to it is:

Code: Select all

   while ((
         ((CustomSep) || (szTemp[i] != ' '))
      && ((CustomSep) || (szTemp[i] != '\t'))
      && ((CustomSep) || (!CSV) || (szTemp[i]!=','))
      && ((!CustomSep) || (szTemp[i]!=Separator))
      && ((!AnyNonAlphaNum) || (
            (szTemp[i]>='0' && szTemp[i]<='9') ||
            (szTemp[i]>='a' && szTemp[i]<='z') ||
            (szTemp[i]>='A' && szTemp[i]<='Z') ||
            (szTemp[i]=='_')
            ))
      && (szTemp[i] != 0)
      && ((!ToParen) || (szTemp[i] !=')'))
      )
Lines 6-10 appear to cause it to break on a space, even when you have a CustomSep defined. This is just a visual inspection, I could be wrong. I'd test, but work doesn't let me have a compiler :(