You are completely off. Have you even read anything about the basics on Ruby? I'm really glad you are trying, and putting a lot of effort into it, but it honestly looks like you are starting from the middle and working your way outwards, rather than at the start and working to the end.
Okay, a <Game_Event> object has a variable called 'list', which you are looking for.
That variable contains an array of RPG::EventCommand objects, which have three variables available:
code: the event code (this is an integer value that represents what kind of event command is being used.
Comments will return 108)
indent: This is useless, ignore it.
parameters: The description in the help file for this is WRONG. Parameters can be any number of things, depending on what type of event command it is. For example, if it is a Message Window command, the parameters would be a string. You can see what they are by looking in the Interpreter at how they are used.
So, lets say that the variable
event is already set to a <Game_Event> object, so it's easy for us. You'd probably want to do this in a loop:
for event in $game_map.events.values
That will check every event on the map, one by one, using the variable name
event.
Now, you'd want to check the event's list, so you can see what commands it has, and hopefully find the appropriate Comment.
This will loop through all the event commands in the list, calling them
item.
This will return true, if the code is a Comment, which is exactly what we want.
You can now determine the contents of the comment by checking that
item's parameters variable.
comment = item.parameters[0]
You now officially have a variable set to the contents.
So this code would look like this:
for event in $game_map.events.values
for item in event.list
if item.code == 108
comment = item.parameters[0]
end
end
end
If you want to test this, create a new map/project whatever, create an Event and give it a comment that says 'Hello World' and a Call Script. The EventCommand window show look as follows:
[color=green]Comment: Hello World[/color]
[color=grey]Call Script: event = $game_map.events[1]
for item in event.list
if item.code == 108
comment = item.parameters[0]
print comment
end
end[/color]
Try that out, and see how it works.