Wracking my brain on this one. I am making myself a simple script to drop stuff. I want to be able to do ;drop 5 emerald and it will drop 5 emerald and stop. I also want it to drop multiple items, like if I do a ;drop diamond emerald sapphire it will drop every diamond, emerald, and sapphire I have. The problem I am running into is some gems I have to get more specific, like I have to do a ;drop "green sap" "yellow sap", "blue sap" and the spaces within each gem are messing things up! there are some random 'respond' in there, I was trying to test things out.
Code:
if script.vars[1].to_i > 0
script.vars[1].to_i.times{
fput "get my #{script.vars[2]}"
result = waitfor(/You remove|Get what?|I could not find|Wait (1|2|3) sec./)
if result =~ /You remove/
fput "drop my #{script.vars[2]}"
elsif result =~ /Get what?|I could not find/
respond "*** NOT ENOUGH ***"
exit
end
}
elsif script.vars[1].to_i == 0
container = GameObj.inv.find{ |item| item.noun == "knapsack" }
Script.current.vars[0].split(" ").each{ |vname|
if script.vars[1] =~ /\s/
respond "* space detected *"
respond "* #{vname} *"
exit
loop{
container = GameObj.inv.find{ |item| item.noun == "knapsack" }
needed_item = container.contents.find{ |item| item.name =~ /#{vname}/ }
if needed_item
fput "get my #{needed_item}"
fput "drop my #{needed_item}"
else
break
end
}
else
respond "* no space detected *"
respond "* #{vname} *"
exit
loop{
container = GameObj.inv.find{ |item| item.noun == "knapsack" }
needed_item = container.contents.find{ |item| item.name =~ /#{vname}/ }
if needed_item
fput "get my #{needed_item}"
fput "drop my #{needed_item}"
else
break
end
}
end
}
exit
end