Arkanium77

Renpy and action refreshing

Aug 17th, 2022
1,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.44 KB | None | 0 0
  1. define e = Character('Эйлин', color="#c8ffc8")
  2.  
  3. init python:
  4.     class MyAction:
  5.         def __init__(self, name):
  6.             self.name = name
  7.             self.available = True
  8.        
  9.         def refresh(self):
  10.             self.available = True
  11.        
  12.         def do(self):
  13.             self.available = False
  14.  
  15.     actions = [MyAction(s) for s in ["default_action", "action1", "action2", "action3"]]
  16.  
  17.     def action_x(i, return_label):
  18.         a = actions[i]
  19.         if a.available:
  20.             a.do()
  21.             renpy.call(a.name, return_label)
  22.         renpy.call(actions[0].name, return_label)
  23.  
  24. # Игра начинается здесь:
  25. label start:
  26.  
  27.     scene bg room
  28.  
  29.     show eileen happy
  30.  
  31.     e "Вы создали новую игру Ren'Py."
  32.  
  33.     menu first:
  34.         "Убирать пункты меню или делать их неактивными?"
  35.         "Убирать":
  36.             call x
  37.         "Делать не активными":
  38.             call y
  39.  
  40.  
  41.     menu second:
  42.         "Обновить действия?"
  43.         "Да":
  44.             "Обновим, что уж там"
  45.             python:
  46.                 for a in actions:
  47.                     a.refresh()
  48.             jump first
  49.         "Нет":
  50.             "Не будем обновлять"
  51.     "Конец"
  52.  
  53.     return
  54.  
  55. label x:
  56.     menu my_menu_x:
  57.         "Действие 1" if actions[1].available:
  58.             $ action_x(1, "my_menu_x")
  59.         "Действие 2" if actions[2].available:
  60.             $ action_x(2, "my_menu_x")
  61.         "Действие 3" if actions[3].available:
  62.             $ action_x(3, "my_menu_x")
  63.         "Довольно":
  64.             "С меня хватит"
  65.     return
  66.  
  67. label y:
  68.     menu my_menu_y:
  69.         "Действие 1":
  70.             $ action_x(1, "my_menu_y")
  71.         "Действие 2":
  72.             $ action_x(2, "my_menu_y")
  73.         "Действие 3":
  74.             $ action_x(3, "my_menu_y")
  75.         "Довольно":
  76.             "С меня хватит"
  77.     return
  78.  
  79. label default_action(return_label):
  80.     e "Я уже делала это сегодня"
  81.     $ renpy.jump(return_label)
  82.  
  83. label action1(return_label):
  84.     e "Действие 1"
  85.     $ renpy.jump(return_label)
  86.  
  87. label action2(return_label):
  88.     e "Действие 2"
  89.     $ renpy.jump(return_label)
  90.  
  91. label action3(return_label):
  92.     e "Действие 3"
  93.     $ renpy.jump(return_label)
Advertisement
Add Comment
Please, Sign In to add comment