Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Special Comments
#2
You can use the split method for strings:

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
Reply }


Messages In This Thread
Special Comments - by PK8 - 03-16-2009, 02:46 PM
Special Comments - by Charlie Fleed - 03-16-2009, 03:27 PM
Special Comments - by PK8 - 03-17-2009, 05:58 AM
Special Comments - by Charlie Fleed - 03-17-2009, 01:54 PM
Special Comments - by PK8 - 03-17-2009, 07:49 PM
Special Comments - by Charlie Fleed - 03-18-2009, 03:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Special Items Separate Menu Diorm 41 37,322 02-10-2018, 06:06 PM
Last Post: Diorm



Users browsing this thread: