Switch Tags ACE
by Kyonides
by Kyonides
Introduction
With this scriptlet you will be able to turn on or off any given switch by leaving 3 different tags in the show text box! 😀
You will see the effects of that action while it is still printing the text on screen! 😮
Ruby:
# * Switch Tags ACE * #
# Scripter : Kyonides Arkanthes
# 2024-01-07
# The script implements the use of 2 game switch tags that look something like
# this: First \s[10] and later \+ or \-
class Window_Base
alias :kyon_switch_tag_win_bs_conv_esc_char :convert_escape_characters
def convert_escape_characters(text)
@switch_block = Proc.new {}
result = kyon_switch_tag_win_bs_conv_esc_char(text)
result.gsub!(/\es\[(\d+)\]/i) do
@switch_id = $1.to_i
@switch_block = Proc.new {|state| $game_switches[@switch_id] = state }
""
end
result
end
def obtain_escape_code(text)
text.slice!(/^[\+\-\$\.\|\^!><\{\}\\]|^[A-Z]+/i)
end
end
class Window_Message
alias :kyon_switch_tag_win_mess_proc_esc_char :process_escape_character
def process_escape_character(code, text, pos)
case code
when '+'
@switch_block.call(true)
when '-'
@switch_block.call(false)
end
kyon_switch_tag_win_mess_proc_esc_char(code, text, pos)
end
end
Terms & Conditions
Free for use in ANY game.
Due credit is optional.
That's it! 😛