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
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Tue Apr 20, 2004 4:51 pm
i would like a line of code please that will check to see if the cursor is empty after i have looted a corpse.
many thanks in advance
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Tue Apr 20, 2004 5:26 pm
MQ2Data has that,
Code: Select all
/newif ${Cursor.ID} /echo Guess there is something on the cursor
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Tue Apr 20, 2004 5:39 pm
/newif ${Cursor} {
is going to give you a parse error if something is on the cursor. It's giving you a string:
/newif Ration {
you want ${Cursor.ID} as Preocts suggests. Make sure to use () around your conditions because the next zip requires it.
/newif (${Cursor.ID}) {
-
ml2517
- a grimling bloodguard

- Posts: 1216
- Joined: Wed Nov 12, 2003 1:12 am
Post
by ml2517 » Tue Apr 20, 2004 5:44 pm
Oh shit, are you kidding me Lax? I didn't think you were going to require that for single expressions like that. Ugh.
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Tue Apr 20, 2004 5:47 pm
so would this work
Code: Select all
sub CheckCursor
/newif (${Cursor.ID}==0) /goto :donelooting
/return
-
wassup
- Official Guardian and Writer of TFM

- Posts: 1487
- Joined: Sat Oct 26, 2002 5:15 pm
Post
by wassup » Tue Apr 20, 2004 5:52 pm
This would:
Code: Select all
sub CheckCursor
/newif (!${Cursor.ID}) /goto :donelooting
/return
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Tue Apr 20, 2004 5:53 pm
Those last two are logically the same thing, both would work fine
-
Fuergrissa
- a grimling bloodguard

- Posts: 607
- Joined: Mon Dec 08, 2003 3:46 pm
- Location: UK
Post
by Fuergrissa » Wed Apr 21, 2004 3:34 am
Thank you to all who helped me, it works great.
-
Shali
- a ghoul

- Posts: 87
- Joined: Sun Dec 07, 2003 12:39 pm
Post
by Shali » Wed Apr 21, 2004 2:17 pm
so now, if something does not have a value to return, it returns 0 instead of null? or is 0 just specific to cursor when returning the value for no item being on the cursor
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Wed Apr 21, 2004 2:55 pm
As Lax has explained, with much more colorful flavor than I can:
By default a failure returns NULL.
This means that if you have nothing on your cursor and try and get the name of nothing you get a failure or a NULL. The great thing is in the /newif statements NULL is handled as being 0 or FALSE.