Ok this is an OpenEUO script and when I try to run the script I press play and I get this:
ENs BuffBar subs loaded
Running On
[17:43:00] Scanning the icon position of Whirlwind Attack.
...p\openeuo\scripts\sub_monster_function.lua:588: attempt to perform arithmetic on global 'nS' (a nil value)
The info is below along with the line 588:
""
function ItemInBag()
name,info = UO.Property(UO.BackpackID)
nS = string.find(info, "Contents: ")
nE = string.find(info, " Items")
sT = string.sub(info,nS+10,nE) <--- Line 588 in script.
nE = string.find(sT,"/")
sT = string.sub(sT,0,nE-1)
if tonumber(sT) ~= nil then
return tonumber(sT)
end
end
function InitItem()
if ItemInBag() > 120 then
print("["..GetTimeFormat().."] Your backpack almost full.")
return "loadoff"
end
""
Ok I asked someone for help with it and they said that it sounds like it has to do with my backpack and I guess the ID. They told me to hover over my backpack to see what it says and it says:
"Backpack
Weight: 17 Stones
Contents: 11/125 Items, 14/550 Stones"
They told me to put the "print(info)" in the script below and press F7 to see where the script breaks at
function ItemInBag()
pause()
name,info = UO.Property(UO.BackpackID)
print (info)
nS = string.find(info, "Contents: ")
print (nS)
nE = string.find(info, " Items")
print (nE)
sT = string.sub(info,nS+10,nE)
print (sT)
nE = string.find(sT,"/")
sT = string.sub(sT,0,nE-1)
print (sT)
if tonumber(sT) ~= nil then
return tonumber(sT)
end
then I playd the script and pressed F7 and it stopped at this line:
t = ScanItems(true,{Type=8901,ContID=UO.BackpackID})
Another person told me to paste this and play it in OpenEUO:
print("bpid: "..tostring(UO.BackpackID))
local t0,t1 = getticks(),0
local name, info = UO.Property(UO.BackpackID)
while ( string.len(tostring(info)) < 10 ) and
( t1 < 10 ) do
wait(50)
name, info = UO.Property(UO.BackpackID)
t1 = t1 + 1
end
print("msec: "..tostring(getticks()-t0))
print("name: "..tostring(name))
print("info: "..tostring(info))
The same person said I should get something back that says something like:
bpid: 1077213918
msec: 70
name: Backpack
info: Weight: 88 Stones
Contents: 32/125 Items, 85/550 Stones
"this person" also said ""this will test whether openeuo is able to read some key variables like backpackid, and how long it takes to populate the info portion of the object's property. sometimes it is empty on the first pass, in which case the code you're using will halt with an error like what you described in your first post. in other words nS may indeed be set to nil on this line:
nS = string.find(info, "Contents: ")
and the rest of the function doesn't take that into account.""
The results I got after hitting play were:
"bpid: 0
msec: 640
name:
info:
"
Can someone help me figure this out?