zzentar
09-11-2014, 02:05 PM
playing around trying to learn regex, I made this stupid script. Useful to me and maybe to you.
Usage is ;<script_name> <item_type> <from_container> <to_container>
It moves any type of item (armor, weapon, reagent, gem, clothing, ect ect) from <from_container> to <to_container>
if script.vars[0] =~ /(.*)\s+(.*)\s+(.*)/
item_type = $1
container1 = $2
container2 = $3
GameObj[container1].contents.each {|item| if item.type =~ /#{item_type}/;fput "get ##{item.id} ";fput "put ##{item.id} in my #{GameObj[container2]}";end}
end
I tried for hours to make this an Alias, but finally gave up.
Drafix gave me the alias
;alias add mover=;eq vars=%w(\?); GameObj[vars[1]].contents.each {|item| if item.type =~ /#{vars[0]}/;fput "get ##{item.id} ";fput "put ##{item.id} in my #{GameObj[vars[2]]}";end}
usage for alias same as the script above
mover <item_type> <from_container> <to_container>
Usage is ;<script_name> <item_type> <from_container> <to_container>
It moves any type of item (armor, weapon, reagent, gem, clothing, ect ect) from <from_container> to <to_container>
if script.vars[0] =~ /(.*)\s+(.*)\s+(.*)/
item_type = $1
container1 = $2
container2 = $3
GameObj[container1].contents.each {|item| if item.type =~ /#{item_type}/;fput "get ##{item.id} ";fput "put ##{item.id} in my #{GameObj[container2]}";end}
end
I tried for hours to make this an Alias, but finally gave up.
Drafix gave me the alias
;alias add mover=;eq vars=%w(\?); GameObj[vars[1]].contents.each {|item| if item.type =~ /#{vars[0]}/;fput "get ##{item.id} ";fput "put ##{item.id} in my #{GameObj[vars[2]]}";end}
usage for alias same as the script above
mover <item_type> <from_container> <to_container>