ScriptUO

Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: Dan123The123Man on December 06, 2015, 10:31:13 AM

Title: Can someone help me with OpenEUO script? I think Backpack ID is the problem.
Post by: Dan123The123Man on December 06, 2015, 10:31:13 AM
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?
Title: Re: Can someone help me with OpenEUO script? I think Backpack ID is the problem.
Post by: Tidus on December 06, 2015, 10:35:45 AM
It would be easier to read your post if you put the code into Code tags. 
Title: Re: Can someone help me with OpenEUO script? I think Backpack ID is the problem.
Post by: Dan123The123Man on December 06, 2015, 10:52:45 AM
is it easier to read now?


EDIT: Gah I just realized this was posted under the EasyUO section... Can someone move this to the OpenEUO section, or it doesnt matter I mean if someone from EasyUO would know about OpenEUO it doesnt matter to me.
Title: Re: Can someone help me with OpenEUO script? I think Backpack ID is the problem.
Post by: 12TimesOver on December 07, 2015, 07:16:10 AM
It really doesn't matter but I did move it for you, might as well keep OEU with OEU :)

X
Title: Re: Can someone help me with OpenEUO script? I think Backpack ID is the problem.
Post by: Endless Night on December 07, 2015, 12:58:08 PM
long time since i did any openeuo....  so of no help but glad to see my OpenEUO Buffbar code is getting some use