Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Checking Event Comments

Status
Not open for further replies.

Aran

Member

how can i find out if a comment matches a specific comment?

like if I want to see if a comment says "Hello World?"
 
If you are talking about reading event comments, you need to fetch the Game_Event (it's in the faq), read the list, check for comment line codes, and check the string (@parameters[0]).

Code:
event = $game_map.events[event_id]
unless event.erased
  unless event.list.nil?
    event.list.each do |event_command|
      if event_command.code == 108 && event_command.code == 408
        string = event_command.paramters[0]
          if string.include?('some string')
            # Blah

Something like that.
 

Aran

Member

Okay! Question now! is each do an iterating function or a loop that iterates a variable over everything in the array? like a for loop?

plz say i'm right *crosses fingers*

EDIT: and what is command 408? and... i still don't get parameters -_-
 
Yes. The each function just passes through every object in the array.

code 408 is one of the instances of a RPG::EventCommand. You create an event command, you create a RPG::EventCommand. 408 is when a comment goes on to a second line.

Code:
Comment : something # Code 108
something else # code 408
Comment : blah # code 108
blah else # code 408
blah blah blah # code 408

Each line is an event command with it own code a parameters array. For the comment command, paramters = ['Comment line'].

Check my event spawner, as I heavily went into each RPG::EventCommand code, parameters, etc. for every event command.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top