03-16-2009, 03:27 PM
You can use the split method for strings:
[0][0,9] will test the first 9 chars of the first parameter for a match with "Something",
split(' ') returns an array of substrings using the space as separator,
finally to_i is needed to convert the string, in your example "5", into a number,
then do what you want with that...
EDIT: mmm there's something wrong with that... FIXED
Code:
for a in $game_map.events.values
next if a.list == nil
for i in 0...a.list.size
if a.list[i].code == 108 and a.list[i].parameters[0][0,9] == "Something"
# something happens here
substrings=a.list[i].parameters[0].split(' ')
variable=substrings[1].to_i
end
end
end
[0][0,9] will test the first 9 chars of the first parameter for a match with "Something",
split(' ') returns an array of substrings using the space as separator,
finally to_i is needed to convert the string, in your example "5", into a number,
then do what you want with that...
EDIT: mmm there's something wrong with that... FIXED