renpy/doc/cookbook/Tips menu

From Ren'Py

Jump to: navigation, search

Tips menu

With this script you are able to create new menu with buttons to jump in different part of game script.

Example

init:
     # Add the TIPS menu to the main menu.
     $ config.main_menu.insert(2, ("TIPS", "tips", "True"))

     python:
         def tip(text, target, condition):
             if eval(condition):
                 clicked = ui.jumps(target)
             else:
                 clicked = None

             # This shows a textbutton. You can customize it... for example,
             # the xminimum parameter sets how wide the button will be.
             ui.textbutton(text, clicked=clicked, xminimum=400)

label tips:
     # Show the tips background.
     scene bg tips_background

     # Show the tips menu in the middle of the screen.
     $ ui.vbox(xalign=0.5, yalign=0.5)

     # Show each tip, using the tip function. The three arguments are:
     # - The text of a tip.
     # - The label that we jump to if the tip is picked.
     # - A string containing an expression, that determines if the tip is
     #   unlocked.
     $ tip("Tip #1", "tip1", "persistent.unlock_tip_1")
     $ tip("Tip #1", "tip2", "persistent.unlock_tip_2")

     # etc. for as many tips as you want.

     $ tip("Stop viewing TIPS.", "end_tips", "True")
     $ ui.close()
     $ ui.interact()

label end_tips:
     return

label tip_1:
      "Perhaps you should have checked to see if that was a carton of oatmeal,
       or a carton of rat poison."

       jump tips

label tip_2:
      "She's a TRAP!"

      jump tips
Personal tools