Well, Again again, I was scripting with this MACL method, but, this code has several problems that I can't fix.. So I need help with this.
The problems that I found:
- If the Event is Erased, the comment cheking still working. (This one is easy to solve, but I think, this must be script work by Itself, but don't work).
- Only works for 1 event page. (Only 1 page, i think the idea of this, is that read the event current page, but this scripts doesn't do that, only read the defined page).
This is the Code:
A Call Example:
Comment: Gold 100
Well, maybe anyone can fix this, or can recreate this to make it work correctly.
Thanks.
The problems that I found:
- If the Event is Erased, the comment cheking still working. (This one is easy to solve, but I think, this must be script work by Itself, but don't work).
- Only works for 1 event page. (Only 1 page, i think the idea of this, is that read the event current page, but this scripts doesn't do that, only read the defined page).
This is the Code:
Code:
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :erased
attr_reader :event
#-------------------------------------------------------------------------
# * Name : Event Comment List
# Info : Gets the Info from the comments in events
# returns A Hash setup like so {'trigger' => info}
# Author : Trickster
# Call Info : Variable Amount, String used for triggers
# Comments : Detects Integers, Floats, Arrays and Hashes, else its a string
#-------------------------------------------------------------------------
def event_comment_list(*triggers)
# Setup Parameters
parameters = {}
# Run Through Each Page With Index
@event.pages.each_with_index do |page, index|
parameters[index] = {}
list = page.list
return if list == nil or not list.is_a?(Array)
list.each do |command|
next if command.code != 108
comment = command.parameters[0]
array = comment.split
trigger = array[0]
value = array[1...array.size].join
value = value.to_i if value =~ /\d+/
value = value.to_f if value =~ /\d+\.\d+/
value = eval(value) if value =~ /\[\.+\]/ or value =~ /\{\.+\}/
parameters[index][trigger] = value if triggers.include?(trigger)
end
end
return parameters
end
end
A Call Example:
Comment: Gold 100
Code:
args = ['Gold', 'Silver', 'Bronze']
page = 0
if $game_map.events[1].event_comment_list(*args)[page].include?('Gold')
$game_party.gold += $game_map.events[1].event_comment_list('Gold')[0]('Gold')
end
Well, maybe anyone can fix this, or can recreate this to make it work correctly.
Thanks.