Go Help > Console, type and run this:
local ammuMax = getuseroption("AmmuMax")
print(type(ammuMax), ammuMax)
Post the result here.
Go Help > Console, type and run this:
local ammuMax = getuseroption("AmmuMax")
print(type(ammuMax), ammuMax)
Post the result here.
here is the result :
string 13
Okay, try this then on the action you said isn't working:
auto(100)
if $rhand.count < tonumber(getuseroption("AmmuMax")) then
setsetting('Looting/LootList/spear/Action', 'Loot')
else
setsetting('Looting/LootList/spear/Action', 'Ignore')
end
actions is still working but i reload the script here are the 2 errors i got now :
error in Persistent script speaschecker:
["if $rhand.count < tonumber(Maxspears) ..."]:speaschecker:5 attempt to compare number with nilSpearschecker :error in Persistent script spearschanger:
["if $rhand.count < tonumber(getuseropt..."]:spearschanger:3 attempt to compare number with nil
local spears = 3277 -- id of spear
local Maxspears = getuseroption("AmmuMax")
auto(100)
if $rhand.count < tonumber(Maxspears) then
equipitem(spears, 'rhand')
end
Spearchanger :
[FONT=Courier New]auto(100)[/FONT] [FONT=Courier New]
[/FONT]
[FONT=Courier New]if $rhand.count < tonumber(getuseroption("AmmuMax")) then[/FONT]
[FONT=Courier New]setsetting('Looting/LootList/spear/Action', 'Loot')[/FONT]
[FONT=Courier New]else[/FONT]
[FONT=Courier New]setsetting('Looting/LootList/spear/Action', 'Ignore')[/FONT]
[FONT=Courier New]end[/FONT]
Last edited by sylomex; 12-21-2013 at 01:10 PM.
auto(100)
local ammuMax = getuseroption("AmmuMax")
print({'ammuMax', ammuMax, type(ammuMax)})
print({'$rhand.count', $rhand.count, type($rhand.count)})
if $rhand.count < tonumber() then
setsetting('Looting/LootList/spear/Action', 'Loot')
else
setsetting('Looting/LootList/spear/Action', 'Ignore')
end
here are the results of the print
{"ammuMax", "13", "string"}{"$rhand.count", 13, "number"}error in Persistent script spearschanger:
[" if $rhand.count < tonumber() ..."]:spearschanger:9 bad argument #1 to 'tonumber' (value expected)
stack traceback:
[" if $rhand.count < tonumber() then"]:spearschanger:9 in user script