Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

MessageBox with custom buttons instantiated from dynamic script #367

Open
lolslayer opened this issue Jun 16, 2017 · 2 comments
Open

MessageBox with custom buttons instantiated from dynamic script #367

lolslayer opened this issue Jun 16, 2017 · 2 comments

Comments

@lolslayer
Copy link

This will be my last issue that I was planning to add, so don't worry. :P

For scripting, it could be extremely useful if it's possible to have a function where you can make a message box popup. Where you can add in custom buttons (custom in a way that they have a custom text in them and clicking them will run your custom code).

This could look like this in code:

Actions.Buttonbox(Player,"Text in the message box");
     Buttons.AddOption("Text in the button'){
          //Code
     }
     Buttons.AddOption("Text in the button'){
          //Code
     }
     Buttons.AddOption("Text in the button'){
          //Code
     }

So when pulling of the action Actions.Buttonbox(), all upcoming Buttons.AddOption() that were called in the same tick will be added into the message box with the buttons.

A great example what you can do with this, in combination with my issue where you have keys reserved for scripting, is that you canmake an ingame Alliance system. With a dedicated key you call in a buttonbox with the name of every player in the game. When clicking on them you can send an Alliance request. When doing that, the player that gets the request will get a button box where he can accept or deny the Alliance request.

@Kromster80 Kromster80 changed the title Scripting: Buttons MessageBox with custom buttons instantiated from dynamic script Jun 18, 2017
@Kromster80
Copy link
Owner

The code to create it would probably be:

dialog_id := Actions.ButtonBox(Player, "Text in the message box", "button1 text", "button2 text", "button3 text");

and corresponding event where dialog_id will be needed:

OnButtonBoxClick(aDialogId, aButtonId);

Note that unless we have a modal mode dialogs (which is not viable in MP yet), the events could never be fired, if player decides to ignore the dialog.

@lolslayer
Copy link
Author

Yeah, that sounds great.

But that's the idea, right? That when the player decides not to click on any button, the button events will never fire. Or did I understand it wrong?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants