Event chat

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

mongo
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jun 22, 2003 7:52 pm

Event chat

Post by mongo » Wed Jun 25, 2003 10:49 am

looking over some scripts, why all the IF statments for $p1 $p2 $p3 etc,

why not just /target $p1 $p2 $p3 $p4, no matter how long it is?

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Re: Event chat

Post by grimjack » Wed Jun 25, 2003 7:05 pm

mongo wrote:looking over some scripts, why all the IF statments for $p1 $p2 $p3 etc,

why not just /target $p1 $p2 $p3 $p4, no matter how long it is?

Code: Select all

   /if n $strlen("$p1")<=0 { 
      /return 
   } else /if n $strlen("$p2")<=0 { 
      /target "$p1" 
   } else /if n $strlen("$p3")<=0 { 
      /target "$p1 $p2" 
   } else /if n $strlen("$p4)<=0 { 
      /target "$p1 $p2 $p3" 
   } else /target "$p1 $p2 $p3 $p4" 
   /tell $MasterName my target is %t 
With /target $p0 $p1 $p2 $p4
If I send a tell to the bot:

/tell bot target Vind

It will attempt to target "Vind " (This might not match for Vindicator due to the trailing 3 spaces). We want it to attempt to target "Vind" (This will match for Vindicator). I do it more for clean code than anything.

This is a better example of where it will break:

Code: Select all

   /assist $MasterName 
   /if n $strlen("$p1")<=0 { 
      /return 
   } else /if n $strlen("$p2")<=0 { 
      /tell "$MasterName" Casting $p1 on %T 
      /call SpellSub $p1 
   } else /if n $strlen("$p3")<=0 { 
      /tell "$MasterName" Casting $p1 $p2 on %T 
      /call SpellSub "$p1 $p2" 
   } else /if n $strlen("$p4)<=0 { 
      /tell "$MasterName" Casting $p1 $p2 $p3 on %T 
      /call SpellSub "$p1 $p2 $p3" 
   } else { 
      /tell "$MasterName" Casting $p1 $p2 $p3 $p4 on %T 
      /call SpellSub "$p1 $p2 $p3 $p4" 
   /stand 
   /if "$SitAfterCast"=="1" /sit on 
   /press esc 
This one passes a spell name to another part of the script. If I have it /call SpellSub "Ice Comet " ($p1 $p2 $p3 $p4). It will break the macro. I have to have it do /call SpellSub "Ice Comet" ($p1 $p2). Here is why it will break.

Code: Select all

   /varset SpellName "$p0" 
   /varset SpellSlot "$char(gem,"$SpellName")" 
   /varset CastTime "$spell("$SpellName",casttime)" 
$spell("Ice Comet",casttime) works
$spell("Ice Comet ",casttime) does not.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack