Pop-up Menus

From EventScripts Community Encyclopedia

Contents

Initializing the display

Now we need to create the popup menu:

popup create Example

Now we have made sure that there isn't any current menu named Example, we will move onto adding lines to the menu

Adding Lines and Setting the duration

Adding a line

Now we will add a line to the popup named Example:

popup addline Example "Welcome to my server!"

This will add the content "Welcome to my server!" to the bottom of the menu.

Setting the duration

To set the duration, use the following popup command:

popup timeout Example view 0

As you can see, we have made "Example"'s view time to 0, simply meaning infinite (default value).

How to display the menu

You can display the menu at any moment, as long as you have the recipients UserID. This can be retrieved by using numerous commands, but they will only work in certain instances.

es_getuserid    // For use if you do not have the UserID at hand
es_getcmduserid // For use in commands
// ...and other commands 

If you want to send the menu to a player once they have connected, use the following code in the event "player_activate":

es popup send Example event_var(userid)

Note the es prefix. This is to expand the event variable userid. Library commands do not expand server_var's or event_var's, thats why you will need to use the es prefix.

There are lots of complex examples of uses of popup on the forums, if you would like to see some more commands for popup, take a look at: Popup

blog comments powered by Disqus