Code: Select all
occupiedSlots, totalSlots = sendMacro("GetBagCount();");
Code: Select all
if occupiedSlots <60 blah blah
Code: Select all
local occupiedSlots = sendMacro("GetBagCount();"); repeat until occupiedSlots
Code: Select all
occupiedSlots, totalSlots = sendMacro("GetBagCount();");
Code: Select all
if occupiedSlots <60 blah blah
Code: Select all
local occupiedSlots = sendMacro("GetBagCount();"); repeat until occupiedSlots
What you want should be this:swietlowka wrote:when i use:sometimes i get an error that i cannot sompare unmber with nil value, since i use it like this:Code: Select all
occupiedSlots, totalSlots = sendMacro("GetBagCount();");
the only thing that vould be nil is occupiedSlots... so my question is can i use it like that for this purposeCode: Select all
if occupiedSlots <60 blah blah
will that fix those errors? i dont use totalSlots anywhere... is it needed there?Code: Select all
local occupiedSlots = sendMacro("GetBagCount();"); repeat until occupiedSlots
Code: Select all
repeat local occupiedSlots = sendMacro("GetBagCount();"); until occupiedSlots
Code: Select all
inventory:itemTotalCount(0);
Code: Select all
inventory:itemTotalCount(0);
Guessing it was done by a developer I'd say YES! Never gave me 1 error... ever!swietlowka wrote:lol never though of that lol...
but iserror proof? i mean like nil value or such?Code: Select all
inventory:itemTotalCount(0);
Just wanted to point out u are better off using > and not <, it can mess upswietlowka wrote:Code: Select all
if occupiedSlots <60 blah blah
Code: Select all
if 60 > occupiedSlots then ......
That should bejduartedj wrote:Code: Select all
repeat local occupiedSlots = sendMacro("GetBagCount();"); until occupiedSlots
Code: Select all
local occupiedSlots
repeat occupiedSlots = sendMacro("GetBagCount();"); until occupiedSlots
Any functions that read values from memory are more reliable. sendMacro (and RoMScript) can, as you've discovered, sometimes fail and return nil. So if you are ever using them and nil is not a possible value then use the repeat loop trick above. Although it might be better to use "until thevalue ~= nil" to cover functions that return true or false.swietlowka wrote:lol never though of that lol...
but iserror proof? i mean like nil value or such?Code: Select all
inventory:itemTotalCount(0);
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 1 guest