test if a bagslot is empty

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Thor
Posts: 1
Joined: Wed Mar 03, 2010 10:32 am

test if a bagslot is empty

#1 Post by Thor » Wed Mar 03, 2010 10:45 am

Hello together,

is where anybody able to tell me a way to test if a bagslot is empty? I tried it thies way:

if ( inventory.bagslot[59] not null ) then ....

but it doesn't work.

Thx for help

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: test if a bagslot is empty

#2 Post by rock5 » Mon Mar 08, 2010 1:15 am

That's not proper lua code. Assuming inventory.bagslot[59] is correct(which I haven't checked) try;

if not (inventory.bagslot[59] == null ) then ....

or

if ( inventory.bagslot[59] ~= null ) then ....

or just

if inventory.bagslot[59] then ....

because if used in this way, a nul value is taken to be false and any other value is taken to be true. Read it as;
'if inventory.bagslot[59] has a value then ...'
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests