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.

Checking for a comment in an event

Alright, scripting newb here.
I'm trying to create a simple script which will call a common event if a comment is there, first I got no errors but it didn't work, now it is getting errors and doesn't work at all.

Code:
class Comment_Stuff
  
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?('Test')
              # Launch the common event
            $game_temp.common_event_id = 8
          end
        end
      end
    end
  end
end
The error is on line 3, and it says "undefined method 'events' for nil:NilClass"
I have no idea what this means, and I can't figure out what to do. :(

Can somebody help me with this simple script?
Please say it easy enough for a newb to understand. @_@
Thanks.
 

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