Page 1 of 1

userfunction_mmdialogs

Posted: Wed Jun 17, 2015 4:43 am
by Celesteria
hello there,

this is a small userfunction for adding some questions into your waypoint files. I often use the same file and dont want to edit variables by hand for every different usage. So I wrote some little functions to display a little dialog within the mm-window to set variables on startup.

Code: Select all

examples:
  local flag	= UMMD_chooseFlag ('do you want to use home runes to change class?', false)
  local num	= UMMD_chooseNumber (0, inventory:itemTotalCount (??????), 'how many ??????')
  local num	= UMMD_chooseClass (68, 'class to accept demonstration battle')
  local key	= UMMD_chooseList ({ ['l']='left, ['r']='right', ['d']='down', ['u']='up'}, 'which direction?')
It would be nice if someone has a way to handle this dialogs also ingame :)


function UMMD_chooseFlag (text, default)
------------------------------------------------------------------------------------
-- ask for yes or no
--
-- arguments:
-- text - [optional] text to display
-- default - [optional] default value (boolean)
--
-- returns:
-- true/false
------------------------------------------------------------------------------------

function UMMD_chooseNumber (min, max, text)
------------------------------------------------------------------------------------
-- ask for a number between min and max
--
-- arguments:
-- min - [required] lowvalue
-- max - [required] highvalue
-- text - [optional] text to display
--
-- returns:
-- number
------------------------------------------------------------------------------------

function UMMD_chooseList (list, text)
------------------------------------------------------------------------------------
-- ask for an entry of a given list
--
-- arguments:
-- list - [required] a list of options (option format: key="text")
-- text - [optional] text to display
--
-- returns:
-- key of the list
------------------------------------------------------------------------------------

function UMMD_chooseClass (minLevel, text)
------------------------------------------------------------------------------------
-- ask for one of the available classes of the player
--
-- arguments:
-- minLevel - [optional] level of the class must be at least this level
-- text - [optional] text to display
--
-- returns:
-- classID
------------------------------------------------------------------------------------


Version 1.2
* updated function names to fit my private policy of userfunction nameing
* updated UMMD_chooseClass to work correctly after class change
Version 1.1
* improved function chooseList to handle numeric and string keys
Version 1.0
* initial release

Re: userfunction_mmdialogs

Posted: Sat Jun 27, 2015 7:15 am
by Celesteria
updated to version 1.2