[RMVX-ACE] [LUNA ENGINE] DRAW TEXT ON MENU BASED ON SWITCH

Posts

Pages: 1
I am using the VXA Luna Engine scripts to customize my menus. What I am hoping to do is draw a "Difficulty" text based on switches that are activated at the start of the game. Particularly, switches 997, 998, and 999 are tied to Easy, Normal, and Hard respectively.



This segment of the menu is Window_GOLD (all treated as one window), of which I've added the Playtime counter, and two variables at the bottom. What I want to add to the empty space is the text "Easy", "Normal", or "Hard" based on which of the three switches is turned on.

The timestamp was added via "Configuration Main Menu" and the two variables were added in "Lunatic Config Main Menu" with the following configuation:


# -----------------------------------------------------------------
# This method allows you to modify the Gold Window
# -----------------------------------------------------------------
def self.user_gold_text(contents)
# -----------------------------------------------------------------
# This changes how font is displayed in Gold_Window
# -----------------------------------------------------------------
result = [
["#{$game_party.gold}#{Vocab::currency_unit}",
[-32, 0], [136, 2], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],
["#{$game_variables[5]}",
[32, 62], [24, 0], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],
["#{$game_variables[6]}",
[88, 62], [24, 0], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],

]

end
end
end


My problem is that I can't figure out the syntax to make one of the three texts appear based on those switches. I assume I need to use an "if" statement, but I cannot figure out the formatting for it. If anyone familiar with the workings of Luna Engine knows how to do this, please let me know!
Red_Nova
Sir Redd of Novus: He who made Prayer of the Faithless that one time, and that was pretty dang rad! :D
9192
I'm not 100% sure on the proper syntax either, but you can brute force it by doing this:


# -----------------------------------------------------------------
# This method allows you to modify the Gold Window
# -----------------------------------------------------------------
def self.user_gold_text(contents)
# -----------------------------------------------------------------
# This changes how font is displayed in Gold_Window
# -----------------------------------------------------------------
result = [
["#{$game_party.gold}#{Vocab::currency_unit}",
[-32, 0], [136, 2], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],
["#{$game_variables[5]}",
[32, 62], [24, 0], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],
["#{$game_variables[6]}",
[88, 62], [24, 0], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],


["#{get_difficulty}",
[88, 72], [24, 0], [255, 255, 255], ["Grand9K Pixel", 24, true, false]],

]

end

def self.get_difficulty
return "Easy" if $game_switches[997]
return "Normal" if $game_switches[998]
return "Hard" if $game_switches[999]
return "NO SWITCH" #Error checking to show you that no difficulty switch is set
end
end
end
I took a guess on the Y position, but you'll have to fine tune the exact positioning yourself.

Hope that helps!
Awesome!



Works perfectly! Thank you so much!
Red_Nova
Sir Redd of Novus: He who made Prayer of the Faithless that one time, and that was pretty dang rad! :D
9192
Happy to help!
Pages: 1