DOS-style lists
doubleoathseven
01 Dec 2017, 10:55I've been trying and failing to implement a command - let's call it commhelp
- that, when typed into the prompt box by the player, results in a list being spat out of all available commands, much like in DOS with the traditional help
, but have been completely unable to work out how to do this.
I'm using the web editor and cannot read code, though I'm trying.
The Pixie
01 Dec 2017, 13:59For a list of commands, use the ScopeCommands
function. It will not say what they do, however. For that, you would have to type it all out.

K.V.
01 Dec 2017, 15:17Hello.
This is a 'blank' game.
I only added the script that prints this.
I did not assign any verbs to anything.
I did not create any commands.
I'm not sure this code will paste into the web editor without causing an error, but you can use this list, if worse comes to worse.
If you add any verbs or commands, it will probably add something strange to this list, especially if you create a command without naming it. (The command's name is what will show up on this list.)
NOTE: I know... You said you can't read code. I'm sorry, but feel free to copy and paste anything I post on this site. And feel free to ask what something means or does. (We've got your back!)
ANOTHER NOTE: This lists EVERY command (and custom verb) in the game.
exclude = NewObjectList()
list add (exclude, lookdir)
list add (exclude, lookat)
list add (exclude, removefrom)
list add (exclude, givesingle)
list add (exclude, useon)
list add (exclude, alttellto)
list add (exclude, siton)
list add (exclude, tellto)
list add (exclude, listento)
list add (exclude, lieon)
list add (exclude, turnon)
list add (exclude, turnoff)
cmds = NewStringList()
cmdsToAdd = Split("sit on;listen;lie on;turn on;turn off", ";")
foreach (cmd, ListExclude(ScopeCommands(), exclude)) {
list add (cmds, cmd.name)
}
cmds = ListCombine(cmds, cmdsToAdd)
cmds = FormatList(cmds, ",", ", ", "non-existent")
msg ("<h3>Available commands:</h3><hr/>"+cmds+"<hr/>")
The output:
Available commands:
take, drop, use, undo, inventory, look, quit, go, open, close, put, give, ask, tell, oops, speak, buy, climb, drink, eat, hit, kill, kiss, knock, lick, lock, move, pull, push, read, search, show, smell, taste, throw, tie, touch, turn, unlock, untie, listen, jump, sit, lie, sleep, wait, xyzzy, help, save, wear, remove, sit on, listen, lie on, turn on, turn off

K.V.
01 Dec 2017, 15:54WARNING:
If you add verbs when editing online, you can't edit them without writing a lot of code.
I just added a verb while testing this online, and it added k5 to my list:
take, drop, use, undo, inventory, look, quit, go, open, close, put, give, ask, tell, oops, speak, buy, climb, drink, eat, hit, kill, kiss, knock, lick, lock, move, pull, push, read, search, show, smell, taste, throw, tie, touch, turn, unlock, untie, listen, jump, sit, lie, sleep, wait, xyzzy, help, save, wear, remove, k5, sit on, listen, lie on, turn on, turn off
Oh well.
At least we ended up with that first list I created. It lists all of the default stuff, I think.
...except for SPEAK TO.
jmnevil54
01 Dec 2017, 21:06K.V.
If you add verbs when editing online, you can't edit them without writing a lot of code.
What do you mean? It's fairly easy to edit verbs online...?

K.V.
02 Dec 2017, 00:26jm,
You can, but it's not easy (especially for those who are new to coding).
Remember this?
http://textadventures.co.uk/forum/quest/topic/le6_eedqyuqajbos_tkh_g/how-do-i-debug-get-rid-of-this-error#b5a45748-2116-4241-9c41-0348bef21187
mrangel
02 Dec 2017, 12:15Rather than adding cmd.name
to your list, it might make more sense to use cmd.pattern
. But then you'd need to manipulate the string a little; chop a ^ off the beginning if it's a regex, and remove (?<object
and everything after it to get the basic command. For a human-readable list of commands, you'd probably want to strip all ^
and (
from the beginning, and then include everything up to a (
, )
, or |
.
(Not sure if you can see Quest's #object#
style patterns within the game. If you could, you'd just remove the first parameter and everything after it)

K.V.
02 Dec 2017, 14:38Not sure if you can see Quest's #object# style patterns within the game.
If you can, I could never figure it out. (I ended up looking in a save file, and it's all RegEx.)
I didn't consider replacing ?<object>
with #object#
and chopping off extra characters. That's a good idea.
jmnevil54
02 Dec 2017, 21:39I didn't know what you meant. Apparently you meant adding and deleting verbs.
Also my game file had a major glitch, so that was different.
Edit, for doubleoathseven:
Actually, for my game I tried deleting the verb on the offline version, but that didn't work. Nonetheless, I showed the faulty code to the others, and they suggested I add a code like this in the initialization script:
foreach (cmd, AllCommands()) {
pattern = cmd.pattern
if (Left(pattern, 5) = "^dead") {
destroy (cmd.name)
}
}
Supposedly the verb was called dead or k7, or something.
But none if this worked because the game file was just bugged, and I had to copy and paste the code into a new game.

K.V.
02 Dec 2017, 22:45Yeah... I was posting from my phone, so I kept it brief. Too brief, in fact.
As far as this thread is concerned, though:
Once you create a verb (which is really a command (which is really an object)), you can't change the name with the web editor.
...and you can't change an object's name once play begins (as far as I know).