|
|
 |
View previous topic :: View next topic |
 |
|
|
|
|
Author |
Message |
|
|
|
|
|
Ogerboss

Joined: 05 Aug 2006 Posts: 1300 on topic Location: Berlin / Asteroidengürtel in Nopileos Memorial

|
Posted: Wed, 6. Oct 10, 20:24 Post subject: [WiP] <RetVar/IF> open custom menu: title=<Var/String> description=<Var/String> optio |
|
|
[skip|else] if [not]|while [not]| <RetVar> = open custom menu: title=<Var/String> description=<Var/String> option array=<Var/Array>
START|[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar> = The return value, indicating the player's choice. The object type depends on the specifications the scripter made while defining the custom menu and can be any object/value, except NULL.
title=<Var/String> = The headline that appears in the upper left of the menu window.
description=<Var/String> = The hint message that will appear below on the headline, but right-aligned.
option array=<Var/Array> = An array object, that contains the custom menu that you want to show the user.
This command can be used to get input from a user in an interactive way without spamming his logbook with incoming questions. For a general overview of custom menus functionality and their internal structure see this topic.
To use it, first employ the predefined commands to set up a custom menu for the option array argument containing all the choices, information and options you need or build it by hand, if you know how the custom menus are set up. Then use this command to show the custom menu on the screen. If your menu contains any value selection lines, their return values will be stored in the variables you designated when adding the choice to the menu.
The <RetVar> of the custom menu itself will have the specified value for the selected item, when the player closes the menu properly by making his selection. Keep in mind that he can also close the menu abnormally by hitting the escape-key, in this case the return value seems to be -1 (as integer?) if the custom menu had at least one valid choice. Otherwise the return value seems to be not clearly defined.
Please keep in mind that it works as a pop-up, so if intend to show these menus not only on user-request, think about implementing a check for save environments to avoid frustated users, that lost a battle due to your pop-up.
Command Location:
»» Other
<RetVar/IF> open custom menu: title=<Var/String> description=<Var/String> option array=<Var/String>
tbd:
-check return value for aborting the menu
-linking to further articles
Examples necessary or just linking to the general discussion with examples (in future...)?
|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
mark_a_condren

Joined: 03 Aug 2005 Posts: 1384 on topic Location: Newcastle - Australia

|
Posted: Thu, 7. Oct 10, 04:01 Post subject: |
|
|
| Quote: |
| -check return value for aborting the menu |
Can't say i've come across a situation that 'Esc' does not produce '-1'. I use,
skip if not $menu.return = -1
| goto lable Exit
.
.
.
Exit:
return null
and havn't had a situation that it didn't exit if 'Esc' was selected. (I put this directly after each menu i use because i got caught with some of my first scripts having wierd behaviour if esc was used due to not allowing for it ). However, you can replace Exit with another location such as reopening the menu if you wish to 'Force' the player to make a choice in an 'Options' menu for example.
I've also used it when i've displayed a menu with just 1 non selectable (return value = null) line of information for example, and it has worked ok. Mind you, you could make the 'return value = -1' and that would work also.
----------------------------------------
Possibly a small example would be good, such as,
$player.ships = get ship array: of race Player class/type= Moveable ship
$ret = open custom menu: title='Your Moveable Ships:' description='Make a selection from the list below.' option array=$player.ships
skip if not $ret = -1
| goto lable Exit
$ship = $player.ships[$ret]
In the above example, $ret will be the index in the array $player.ships that was chosen by the user. The entry in the array can then be determined by using '$ship = $player.ships[$ret]' to determine which ship was chosen.
----------------------------------------
Some Questions,
| Quote: |
| think about implementing a check for save environments to avoid frustated users, that lost a battle due to your pop-up. |
OR
| Quote: |
| think about implementing a check for safe environments to avoid frustated users, that lost a battle due to your pop-up. |
| Quote: |
| To use it, first employ the predefined commands to set up a custom menu for the option array argument containing all the choices, information and options you need or build it by hand, if you know how the custom menus are set up. Then use this command to show the custom menu on the screen. |
I found the highlighted line a bit unclear, what if i 'Don't' know how the custom menus are set up? what then? (or is it just me being a bit vague today )
----------------------------------------
Ok, i'm going to go now before you reach through the monitor and grab me by the 'gizzards' .
Take care and i'll catch you in 2 weeks.
Mark
(ps. I like the way you explain things )
|
|
|
|
|
|
|
Back to top |
|
|
|
 |
|
|
|
|
|
|
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
 |
|
|
|
|
|