How can I run a command via script? [Quest]

0 votes
57 views
asked Aug 7 in Authoring by RanDumSocks

Title is quite self-explanatory. I want to have a script that runs a command for me so the user doesn't have to type it. More specifically I want it to use the "look" command so all the information about the room I defined in the game settings is displayed over again.

1 Answer

0 votes
answered Aug 7 by hegemonkhan (161 points)
edited Aug 7 by hegemonkhan
 
Best answer

there's actually a built-in Function which directly does this (as Commands require input from the person playing the game, though there may be a way of calling~invoking a Command too):

http://docs.textadventures.co.uk/quest/functions/corelibrary/showroomdescription.html

in code:

ShowRoomDescription ()
// the () are parenthesis (left and right), not the 'O' letter, nor zero.

or, to do this (the calling of a Function) in the GUI~Editor:

run as script -> add new script -> scripts -> 'call function' Script -> (see below)

Function Name (the small rectangle text box): ShowRoomDescription
Add Parameters (the box box with the 'add' button): (do NOT add any parameters)
// I don't think for the Function Name that you need the parenthesis, but if this doesn't work, then put in the parenthesis, and then it should work.


if you actually wanted to make a Command, and then call upon it... hopefully someone more knowledgeable with quest, can answer, and~or help you with it.


err...

the 'ShowRoomDescription ()' is only for the room that your player is currently within.


if you want for a specific room, which your player is not currently in...

then you just need to do this instead:

in code:

invoke (room_name, "description")
example: invoke (FinalDungeon, "description")

// hopefully invoke works with a pure textual description too, and not only for a scriptive description...

// you can also use 'do' too: http://docs.textadventures.co.uk/quest/scripts/do.html

or, in the GUI~Editor:

not sure how to do it... lol


and for non-room Objects:

invoke (object_name, "look")
example: invoke (Desk, "look")

commented Aug 8 by RanDumSocks (28 points)
That's just what I was looking for and works perfectly thanks!
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...