Updated with a new method - incoming question using 'Incoming Question Handler' by SymTecs ltd (included in the pack by the kind permission of Symtecs ltd).
- Calculator style keyboard which 'pops-up' - so no searching for the message.
- Messages are not written to the logbook - saves all that bloat
- Number entered is formatted, default is to use comma separators, but it is easily changed in the t-file.
Contains everything that was in version 2 as well....
Version 3 available Courtesy of Xai Corporation
Numeric Data Entry pack Version 2 - 2007-06-12
Updated with a lot more information.
This pack is intended for scripters old and new - a lot of documentation for the learner plus working scripts and ideas.
All scripts are meant to be used, modified or just looked at, and are freely available for your own use. If you do use any scripts, then rename them to match your script pack - and of course, change them to do exactly what you want.
The main problem with using scripts is that the user is expected to enter all required information before a script is started. This can limit the use of a script.
If a user is allowed to enter data while a script is running, then the script becomes more flexible. This is not easy with standard scripts, hence this collection of information.
Scripts, hints and tips for the following methods of getting input from the user once a script is running:-
- Incoming question in the form of a numeric keypad - slight update on the original.
- Using the numeric keypad (hotkey) from a script - plus other uses.
- Using a combination of numeric keypad and incoming question.
- "Chaining" scripts to change the function of the command slot - not just for numeric entry, but any entry.
Version 2 available Courtesy of Xai Corporation
Use, learn, and enjoy.
Boron - Ol Fh'art
Update
A tip from UniTrader {KBG}
Something that I did not know:-
B-O'F wrote:
----------------------------------------------------------------------------------
Standard warnings about incoming messages - everything is written to the logbook, and you get that annoying 'incoming message'.
---------------------------------------------------------------------------------
i dont know if you have already solved this, but if not here a small tip from me:
Code: Select all
send incoming question $String to player: callback=<Script Name>
= speak text: page= 0 id= 0 priority= 100
----------------
I said, use, learn and enjoy - well I have just learned something else......
---Original text ---------------------------------------------------
Many times I have seen requests for a way of getting numeric entry from the player while a script is running. There is no way that this can be done --- UNTIL NOW.
This is a set of 3 scripts and a t-file, that uses the incoming question command.
Easy to use - just call 'lib.bof.enter.number', it will return the entered number, or null if cancelled.
The incoming question lays out the keys in a calculator-type format, with the currently entered number at the top:-
Code: Select all
476
[1] [2] [3]
[4] [5] [6]
[7] [8] [9]
[0]
[CE] [Cancel]
[Enter]
Enter when the completed number has been entered.
Cancel aborts the entry.
The screen is instantly refreshed, updating the entered number - no need to get the next message.
The maximum entry is 2,147,483,647 - after that it goes funny... but that should be large enough for most entries.
----------------------------------------------------------------------------------
Standard warnings about incoming messages - everything is written to the logbook, and you get that annoying 'incoming message'.
----------------------------------------------------------------------------------
Other than that, it works very well (what else do you expect from me!).
Scripts:
If you change anything in these scripts, then please rename them.
Remember to change the names called by lib.bof.numeric.entry and lib.bof.num.entry.callback - almost the last line in each. They both call each other - this way the 'keyboard' stays on screen.
lib.bof.enter.number
- handler, starts numeric entry, passes back the answer. You could copy this code into your own script to handle Cancel differently.
lib.bof.numeric.entry
- builds the incoming message, and handles the returned answer. CHANGE the t-file references to your own.
lib.bof.num.entry.callback
- returns the players response to the incoming question - it's only a one liner.
Only one script refers to the t-file - lib.bof.numeric.entry
t-file
- just the data required for numeric entry - copy it to your own t-file.
Currently it is 448893 so you can use this to test it out
Change the $page.id and load text: id in 'lib.bof.numeric.entry' to match your t-file number.
If you change the <t id="xx"> then also change the textid= for msg01, msg02, and msg03 in 'lib.bof.numeric.entry'.
If you change the data in the t-file, especially the \n's, then the formatting will go to pot.. you will then have to try to sort it out....
Available Here as a .zip file, courtesy Xai-Corporation.
Use and enjoy,
Boron - Ol Fh'art