RGSS3 SCRIPTING HALP D:
Posts
Pages:
1
I could use a bit of assistance. Diving headlong into RGSS3 for reasons I don't even know why.
Anyway, I'm a bit stymied. I can't figure out how to refresh a window after a cursor change on a command menu. Can't seem to find the answer in the codebase either.
I've got a command window popping up, as well as a secondary window. I'm not sure how to pass into the secondary window that the cursor has changed positions and thus the draw_text in it needs to change.
Here's the code for those who like that sort of thing.
Anyway, I'm a bit stymied. I can't figure out how to refresh a window after a cursor change on a command menu. Can't seem to find the answer in the codebase either.
I've got a command window popping up, as well as a secondary window. I'm not sure how to pass into the secondary window that the cursor has changed positions and thus the draw_text in it needs to change.
Here's the code for those who like that sort of thing.
#Initializes the dialogue choice into a window with appropriate keys
class Window_DialogueExample < Window_Command
def initialize
#window placement location
super(0,0)
self.x = (Graphics.width - width) / 2
self.y = Graphics.height - height
end
def visible_line_number
return 3
end
def window_width
return 400
end
#creates the command keys list for choices
def make_command_list
add_command("One Pill", :option1)
add_command("Two Pill", :option2)
add_command("Red Pill", :option3)
add_command("Blue Pill", :option4)
add_command("Outies", :exit)
end
end
#Secondary window to fully explain choices
class Window_DialogueExampleDesc < Window_Selectable
def initialize
super(0, 0, Graphics.width, fitting_height(1))
refresh
end
def refresh
contents.clear
draw_text(x, y, width, line_height, "Desc Text Goes Here")
end
end
#Sets objects in the window to play them in a new "scene"
class Scene_DialogueTest < Scene_MenuBase
def start
super
create_background
create_choices
create_description
end
#creates the actual command window for choices
def create_choices
@dtest = Window_DialogueExample.new
@dtest.set_handler(:option1, method(:result1))
@dtest.set_handler(:option2, method(:result2))
@dtest.set_handler(:option3, method(:result2))
@dtest.set_handler(:option4, method(:result3))
@dtest.set_handler(:exit, method(:backout))
end
#creates secondary window to explain choices
def create_description
@dtestdesc = Window_DialogueExampleDesc.new
end
#dialogue choice results
def result1
@dtest.active = true
p 'Right on!'
end
def result2
@dtest.active = true
p 'Yo!'
end
def result3
@dtest.active = true
p 'Yaoooooooo!'
end
#exit menu
def backout
SceneManager.return
end
end
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
You already seem to be refreshing it and redrawing the text every frame. The function runs automatically every frame, so anything in it will happen automatically. Of course the text doesn't actually need to be redrawn every frame, only when it changes... so if you have lag, you could create a way of detecting when it changes. But as you have it coded right now I suspect the only reason why the text isn't changing when you move the cursor is because the text is hardcoded to always be "Desc Text Goes Here". :)
def refresh
Pages:
1