Author Topic: menu with parameters  (Read 99 times)

Realguigui

  • Newbie
  • *
  • Posts: 20
  • Eastmost penninsula is the secret
    • View Profile
menu with parameters
« on: November 16, 2017, 10:10:07 am »
Hello.
I have created a menu to manage the display and use of a digicode. It works but I would like to make it customizable to make it usable with several doors. For the moment, the secret code of the digicode and the name of the door that it opens are hardcoded in the code of the menu. This requires me to create a menu for each digicode. Would there be a way to launch my menu digicode by passing some parameters ("secret codes","door", map etc.) like a function ?
If it's not possible, is it a good idea to use some savegame_variables hardcoded in the menu that I initialize just before the lauch of the digicode's menu ?

Thank you

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: menu with parameters
« Reply #1 on: November 16, 2017, 12:21:29 pm »
You don't need to code a menu for each door. You can pass all the necessary info from the door to the menu with an initialization function.

Realguigui

  • Newbie
  • *
  • Posts: 20
  • Eastmost penninsula is the secret
    • View Profile
Re: menu with parameters
« Reply #2 on: November 16, 2017, 01:52:58 pm »
You don't need to code a menu for each door. You can pass all the necessary info from the door to the menu with an initialization function.

It's not clear for me. Can you tell me where I can found some examples ?

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: menu with parameters
« Reply #3 on: November 16, 2017, 02:22:54 pm »
An example of menu is the inventory menu (the pause menu). You can download any project made by Christopho and study these scripts.

Doors do not have collision tests or events like "on_interaction" or "on_activated", so you should use other entity to detect the interaction somehow and then start the menu. So you really need 2 entities, the door, and other entity to detect the interaction (and you can start the menu when there is interaction with this entity, defining that interactin event from the map script, which would start you menu and initialize it with the particular info).

(Sorry if I don't give more explanations, I am a bit busy. But I'm sure others can help you more if my hints are not enough for you.)

Realguigui

  • Newbie
  • *
  • Posts: 20
  • Eastmost penninsula is the secret
    • View Profile
Re: menu with parameters
« Reply #4 on: November 16, 2017, 11:42:22 pm »
the good thing is that I use a custom entitie to launch the menu exactly like you said. The bad thing is that the scripts of pause menu are very complex and I don't find any help in them.

Thanks anyway.