Originally Posted by
ryaden
I have a few questions regarding manipulating arrays
1. I am trying to delete any object other than one I specify. I have used this but it doesn't work
pickup = GameObj.loot
pickup = pickup.delete_if { |obj| (obj.id.length != /7/)}
GameObj.loot has more than just ids of stuff on the ground, it has items' names, nouns, etc etc. Do ;eq echo "#{GameObj.loot}" in game to see what I mean.
If you want the pickup array to just track the ids of items on the ground you could do something like:
Code:
pickup = Array.new
GameObj.loot.each{|i|
pickup.push(i.id)
}
This would have all ids of stuff in the loot array. Now you can go through each id and determine if the length of said id is 7 characters long.