Create a new project, insert new script sheet, write :
$dialogue = {
:Aaaa => 'aasd',
:Bbbb => 'qweq'
}
class Game_Temp
def message_text=(string)
if string =~ /^\[:(.+)\]$/
@message_text = $dialogue[$1.to_sym]
else
@message_text = string
end
end
end
then, create 2 event :
1. Show Text [:Aaaa]
2. Script print $dialogue
Pictures :
Picture explained :
1. play the game, go to event 2, trigger it, you should see a console window popped out and display : {:Aaaa=>"aasd",:Bbbb=>"qweq"}
2. Go to event 2, trigger it, text box should appear displaying "aasd"
3. go back to event 2, trigger it, you should see a console window popped out and display : {:Aaaa=>"",:Bbbb=>"qweq"}
WTF the value of :Aaaa was gone, how come ? I tried creating another variable called $dialogue2 = $dialogue for backup, after step2, the value of :Aaaa in $dialogue2 was also gone! Someone can explain this ? I'd be happy if someone can fix it