This may be a dumb question
Posted: Sat Apr 24, 2004 12:06 am
Well, this may be a dumb question, but I cant find the answer, and since I dont know the answer Im not sure what to look for, ok, now for the problem, the idea is to able able to cast any spell VIA chat, this is how the old code looked
I realize its a bit sloppy, and of course it requires editing spellcast.inc a little bit to get the correct $Return, but this code worked successfully with MQ2Parm, now here is the code converted to MQ2Data as best as i could
Now, after i've converted it and realize the problem, i run accross Lax's post here: http://macroquest2.com/phpBB2/viewtopic ... =eventchat
Code: Select all
/if "$left(5,"@Param2")"=="buff:" {
/if "$char(book,"$right($int($strlen("@Param2")-5),"@Param2")")"=="NULL" {
/1 You ASS, i have no such spell.
/return
}
/target @Param1
/call cast "$right($int($strlen("@Param2")-5),"@Param2")"
/if "$return"=="CAST_toopower" /1 The spell you want me to cast on the intended Target is to powerful, pick a lower level spell.
/return
}
/if "$left(5,"@Param2")"=="cast:" {
/if "$char(book,"$right($int($strlen("@Param2")-5),"@Param2")")"=="NULL" {
/1 You ASS, i have no such spell.
/return
}
/targ @Param1
/assist @Param1
/delay 5
/call cast "$right($int($strlen("@Param2")-5),"@Param2")"
/if "$return"=="CAST_toopower" /1 The spell you want me to cast on the intended Target is to powerful, pick a lower level spell.
/return
}
Code: Select all
/if (${String[@ChatText].Left[5].Equal[buff:]}) {
/if ("${Me.Book[${String["@ChatText"].Right[${Math.Calc[${String[@ChatText].Length}-5]}]}]}"=="NULL") {
/1 You ASS, i have no such spell.
/return
}
/target @Sender
/call cast "${String[@ChatText].Right[${Math.Calc[${String[@ChatText].Length}-5]}]})"
/if (${Macro.Return.Equal["CAST_toopower"]}) /1 The spell you want me to cast on the intended Target is to powerful, pick a lower level spell.
/return
}
/if (${String[@ChatText].Left[5].Equal[Cast:]}) {
/if ("${Me.Book[${String[@ChatText].Right[${Math.Calc[${String[@ChatText].Length}-5]}]}]}"=="NULL") {
/1 You ASS, i have no such spell.
/return
}
/targ @Sender
/assist @Sender
/delay 5
/call cast "${String[@ChatText].Right[${Math.Calc[${String["@ChatText"].Length}-5]}]})"
/if (${Macro.Return.Equal[CAST_toopower]}) /1 The spell you want me to cast on the intended Target is to powerful, pick a lower level spell.
/return
}
So, the ultimate problem is how I get everything out of a String except the 1st 5 characters in a string that has an unspecified number of characters, without using a ${Math.Calc[]}
The problem is that CALCULATE can only handle NUMBERS. How do you calculate "gfdlkgjdlfgkldfglkdf" The answer is you dont