querying command_stack_character

Posted by Fiendish on Thu 31 Mar 2011 08:14 PM — 3 posts, 9,408 views.

USA Global Moderator #0
How do I get the user's command_stack_character setting?
Australia Forum Administrator #1
The world's settings are stored in the world's XML file. When that file is read in the various things in it are looked up in two tables, one for strings, one for numbers/booleans.

Excepting a couple of minor things, like the date it was written, if you can find it in the XML file, you can get at it with GetOption or GetAlphaOption, depending if it is a string or a number.

This is because the same table is used to populate the world document when the world is being read.

To get an idea of the option names used (apart from editing the world file with a text editor) you can run this code:


for k, v in pairs (GetOptionList()) do 
  Note (v, " = ", GetOption (v)) 
end

for k, v in pairs (GetAlphaOptionList()) do 
  Note (v, " = ", GetAlphaOption (v)) 
end


Running that code, and looking at the relevant part, we see this:


enable_aliases = 1
enable_auto_say = 0
enable_beeps = 1
enable_command_stack = 0
enable_scripts = 1
enable_spam_prevention = 0
enable_speed_walk = 1
enable_timers = 1
enable_triggers = 1
enable_trigger_sounds = 1

...

auto_log_file_name = 
auto_say_override_prefix = -
auto_say_string = say 
beep_sound = 
chat_file_save_directory = 
chat_name = Name-not-set
chat_message_prefix = 
command_stack_character = ;
connect_text = 
editor_window_name = 
filter_aliases = 
filter_timers = 
filter_triggers = 
filter_variables = 
id = 174f95f2bae364f4fefaabb4
input_font_name = FixedSys


So, GetOption ("enable_command_stack") will tell you if command stacking is enabled or not, and GetAlphaOption ("command_stack_character") will tell you, if it is enabled, what the character is.
Amended on Fri 01 Apr 2011 05:06 AM by Nick Gammon
USA Global Moderator #2
Thanks. GetAlphaOption was like the one doc I didn't look at. (doh!) :)