Manual Key Binding to Variables/Show Image
Posted: Sun Jan 21, 2018 8:53 am
I'm afraid I'm a complete novice with Ren'Py and Python code, so I apologize in advance for any confusing vocabulary or oversights.
I am currently trying to assign keyboard keys to specific actions. I've managed to bind keys to jump to specific scenes, but other commands that I can enter normally (or make follow from standard "menu" buttons) return errors following the key assignment. To be more specific, I wish to make a key trigger a temporary show event (~1 second) as well as modify a variable counter.
In the sample code below, the "W" key functions as assigned. The middle three keys return errors, saying: "expected a keyword argument, colon, or end of line."
The game will launch with the final key ("F"), but if the key is pressed, the game will crash, returning an error that "Screen Hikage 1 is not known."
I've tried messing with the format a bit (adding colons and trying different statements), but with no success. It's interesting to me that the formatting here reads the "show" as a Scene rather than an Image, when writing "show" normally will simply add images atop the pre-existing Scene. Perhaps I'm meant to include a "transformation" clause of some kind? I honestly have no guesses regarding the counters.
Any help in setting me straight would be appreciated.
I am currently trying to assign keyboard keys to specific actions. I've managed to bind keys to jump to specific scenes, but other commands that I can enter normally (or make follow from standard "menu" buttons) return errors following the key assignment. To be more specific, I wish to make a key trigger a temporary show event (~1 second) as well as modify a variable counter.
In the sample code below, the "W" key functions as assigned. The middle three keys return errors, saying: "expected a keyword argument, colon, or end of line."
The game will launch with the final key ("F"), but if the key is pressed, the game will crash, returning an error that "Screen Hikage 1 is not known."
Code: Select all
image Hikage 1 = "Hikage.png"
$ hikage_pt = 10
screen actionkeys:
key "K_w" action Jump ("start.mirailand")
key "K_a" action $ hikage_pt -= 1
key "K_s" action $ hikage_pt -= 5
key "K_d" action hikage_pt += 5
key "K_f" action show ("Hikage 1")
Any help in setting me straight would be appreciated.