I was pointing out that if you use
that catches the final index part in "Door_(xxx)" which is never evaluated,
since
always returns true if the event name includes 'door_' in it, which is the same as using
here,
this,
causes this,
to run and grab the event, only if the event's name includes a number at the end and the number is between 0 and 99, so "Door367" will never be grabbed.
(not that you would have 300 doors, but, I digress...)
this
references the parentheses in
which, if you're not expecting to find in the name, you don't need.
so, no point using the comparison when you can use .include?() directly
if all events named "Door" always imply a *door* code word for your logic, then go with .include?("door") and grab whatever results.
(which will NOT work, if you have numberings or other serialized things that would be part of the name, since you have to scan for the logic of it, which .include?() can't account for)
same for "dummy" or whatever naming.... as long as the same name implies the same function, it'll grab the bulk of them regardless of ID.
Code:
$game_map.events.values.select{|ev| ev.name =~ /door_(.*)/i ? true : false }
since
Code:
ev.name =~ /door_(.*)/i ? true : false
Code:
ev.name.include?("door_")
here,
Code:
$game_map.events.values.select{|ev| ev.name =~ /"Door"\s(\d+)/i ? $1.between?(0,99) : false}
this,
Code:
ev.name =~ /"Door"\s(\d+)/i ? $1.between?(0,99) : false
Code:
$game_map.events.values.select{|ev| ev.name [...] }
(not that you would have 300 doors, but, I digress...)
this
Code:
$1.between?(0,99)
Code:
/"Door"\s(\d+)/i
so, no point using the comparison when you can use .include?() directly
if all events named "Door" always imply a *door* code word for your logic, then go with .include?("door") and grab whatever results.
(which will NOT work, if you have numberings or other serialized things that would be part of the name, since you have to scan for the logic of it, which .include?() can't account for)
same for "dummy" or whatever naming.... as long as the same name implies the same function, it'll grab the bulk of them regardless of ID.