Player Must Say a Phrase to Continue
mamessner
01 Dec 2014, 08:15I'm working on the intro sequence to my game, which takes place inside the player's mind. He must repeat a mantra - "My mind is a fortress, but my heart is free" - in order to snap out of his brainwashed haze and begin the game.
I'd like the player to have to type the mantra in order to continue. I thought I could make the entire phrase a command, and then trigger a move to the first real room in the game (an abandoned warehouse). That doesn't seem to be working, though.
Check out my game file. I'm trying to do some fancy stuff for the intro. Not sure if I'm heading down the right path, though. Is there a way to do an intro without having it be a script that runs before entering the first room? Does this have anything to do with why my command isn't working?
I'd like the player to have to type the mantra in order to continue. I thought I could make the entire phrase a command, and then trigger a move to the first real room in the game (an abandoned warehouse). That doesn't seem to be working, though.
Check out my game file. I'm trying to do some fancy stuff for the intro. Not sure if I'm heading down the right path, though. Is there a way to do an intro without having it be a script that runs before entering the first room? Does this have anything to do with why my command isn't working?

Pertex
01 Dec 2014, 10:03Remove the period from your command. The period is an internal character to seperate commands
HegemonKhan
01 Dec 2014, 12:04there's many ways to do intros:
Game (Object) -> Script (Tab) -> 'start' Script -> (your intro scripts)
http://docs.textadventures.co.uk/quest/ ... ation.html
simply use your 'room' Room Object, as your 'intro' room.
Turnscripts, Timers, and etc... scripting methods
and etc etc etc creative ways (that I can't think of) to do an intro (with infinite code design methods).
------------
the two super scripts:
http://docs.textadventures.co.uk/quest/scripts/set.html
http://docs.textadventures.co.uk/quest/scripts/if.html
----------
an example using 'get input' Script, instead of a Command:
http://docs.textadventures.co.uk/quest/ ... input.html
http://docs.textadventures.co.uk/quest/ ... ction.html
Game (Object) -> Script (Tab) -> 'start' Script -> (your intro scripts)
http://docs.textadventures.co.uk/quest/ ... ation.html
simply use your 'room' Room Object, as your 'intro' room.
Turnscripts, Timers, and etc... scripting methods
and etc etc etc creative ways (that I can't think of) to do an intro (with infinite code design methods).
------------
the two super scripts:
http://docs.textadventures.co.uk/quest/scripts/set.html
http://docs.textadventures.co.uk/quest/scripts/if.html
----------
an example using 'get input' Script, instead of a Command:
http://docs.textadventures.co.uk/quest/ ... input.html
http://docs.textadventures.co.uk/quest/ ... ction.html
<function name="mantra_function">
msg ("What was that mantra?")
get input {
// internally, the 'get input' Script sets: result = (your typed-in input)
// String Matching:
if (result = "My mind is a fortress, but my heart is free.") {
// if ("My mind is a fortress, but my heart is free." = "My mind is a fortress, but my heart is free.") {
player.parent = room2
msg ("You remember the correct mantra, and after uttering it, the strange brainwashing goes away, and you now can see your true surroundings.")
} else {
mantra_function
}
}
</function>
mamessner
01 Dec 2014, 17:04Fantastic. I have to say, this is a very supportive community. Wasn't expecting anyone to code for me.
I think I can manage to use a "get input" via the UI instead of a command. Very n00bish question, though: I see a lot of advice/help given in the form of code snippets. How are these used? Where are they entered, and then is the code reflected in the GUI (in the bar on the left?).
I don't know much coding besides very basic HTML/CSS, and I'd like to use Quest as a tool to get better, but I'm not sure how best to use these snippets.
I think I can manage to use a "get input" via the UI instead of a command. Very n00bish question, though: I see a lot of advice/help given in the form of code snippets. How are these used? Where are they entered, and then is the code reflected in the GUI (in the bar on the left?).
I don't know much coding besides very basic HTML/CSS, and I'd like to use Quest as a tool to get better, but I'm not sure how best to use these snippets.

jaynabonne
01 Dec 2014, 20:56If you want the player to be able to type the mantra at any time, while perhaps typing other commands, etc, then you'd want to go the way you originally said, with the command. The "get input" route like above is for when you want to lock the player in until they type in something that matches. So you would drop that function in your game and then call it from... somewhere. Wherever you want the player to have to type only that word or phrase (maybe on the "after entering room" script or in response to a command).
HegemonKhan
02 Dec 2014, 09:51sorry, about the use of code, but it is so much faster to write~type it in for me, then trying to detailedly explain the steps via using the GUI~Editor, and also just needing to copy and paste it around as well, laughs.
----------------
there is this link, if you got a general understand of quest's structure:
viewtopic.php?f=18&t=4771
--------------
I set this scripting as a Function, so~as it can be 'called upon ~ loaded ~ used' from anywhere (any other scripting in your game), and as for this example, it needs to be repeatable (loopable), thus I used a Function, as in quest, Functions allow for easy looping (repeating).
here's an example of calling up it via the 'start' Script (Game -> Scripts -> 'start' Script -> Add new~a script -> 'output' or 'script' category: not sure what category it is under, lol -> 'call function' Script):
and here's an example of not using it as a Function, but still for example of placing it in the 'start' Script:
but we can place this else where too (ignore the il-logic of this, lol), for example:
----------------
there is this link, if you got a general understand of quest's structure:
viewtopic.php?f=18&t=4771
--------------
I set this scripting as a Function, so~as it can be 'called upon ~ loaded ~ used' from anywhere (any other scripting in your game), and as for this example, it needs to be repeatable (loopable), thus I used a Function, as in quest, Functions allow for easy looping (repeating).
here's an example of calling up it via the 'start' Script (Game -> Scripts -> 'start' Script -> Add new~a script -> 'output' or 'script' category: not sure what category it is under, lol -> 'call function' Script):
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>an_algorithm_generated_unique_string</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<author>HegemonKhan</author>
<start type="script">
mantra_function
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<function name="mantra_function">
msg ("What was that mantra?")
get input {
// internally, the 'get input' Script sets: result = (your typed-in input)
// String Matching:
if (result = "My mind is a fortress, but my heart is free.") {
// if ("My mind is a fortress, but my heart is free." = "My mind is a fortress, but my heart is free.") {
player.parent = room2
msg ("You remember the correct mantra, and after uttering it, the strange brainwashing goes away, and you now can see your true surroundings.")
} else {
mantra_function
}
}
</function>
</asl>
and here's an example of not using it as a Function, but still for example of placing it in the 'start' Script:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>an_algorithm_generated_unique_string</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<author>HegemonKhan</author>
<start type="script">
msg ("What was that mantra?")
get input {
// internally, the 'get input' Script sets: result = (your typed-in input)
// String Matching:
if (result = "My mind is a fortress, but my heart is free.") {
// if ("My mind is a fortress, but my heart is free." = "My mind is a fortress, but my heart is free.") {
player.parent = room2
msg ("You remember the correct mantra, and after uttering it, the strange brainwashing goes away, and you now can see your true surroundings.")
} else {
// the way to loop~repeat a Script Attribute (an alternative to using Functions):
invoke (game.start)
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
but we can place this else where too (ignore the il-logic of this, lol), for example:
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>an_algorithm_generated_unique_string</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<author>HegemonKhan</author>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="orc">
<inherit name="editor_object" />
<talk type="script">
msg ("What was that mantra?")
get input {
// internally, the 'get input' Script sets: result = (your typed-in input)
// String Matching:
if (result = "My mind is a fortress, but my heart is free.") {
// if ("My mind is a fortress, but my heart is free." = "My mind is a fortress, but my heart is free.") {
player.parent = room2
msg ("You remember the correct mantra, and after uttering it, the strange brainwashing goes away, and you now can see your true surroundings.")
} else {
// the way to loop~repeat a Script Attribute (an alternative to using Functions):
invoke (game.start)
}
}
</talk>
</object>
</object>
</asl>
HegemonKhan
02 Dec 2014, 10:06About Quest's Structure (and Code Structure):
(match up this code stuff with the GUI~Editor)
Your Game File's Code Block:
Added Libraries (Libraries are like 'Patches', 'Expansion Packs', and 'Mods' of code that is added to your game):
The Game Object (a special Object that holds your game's global settings):
Objects (Player Objects: PCs, Room Objects: Areas~Locations, Other-Object Objects: non-room and non-player Objects: NPCs, furniture, and etc stuff):
and see 'Objects' above for (replacing the words logically): Verbs, Commands, Functions, Object Types (confusingly shortened to 'Types', argh), Timers, Turnscripts, and etc.
Attributes:
(match up this code stuff with the GUI~Editor)
Your Game File's Code Block:
<asl version="550">
(your entire mass of game code)
</asl>
Added Libraries (Libraries are like 'Patches', 'Expansion Packs', and 'Mods' of code that is added to your game):
<include ref="xxx.aslx" />
The Game Object (a special Object that holds your game's global settings):
<game name="xxx">
(your game's global settings' Attribute code lines)
</game>
Objects (Player Objects: PCs, Room Objects: Areas~Locations, Other-Object Objects: non-room and non-player Objects: NPCs, furniture, and etc stuff):
<object name="xxx">
(Attributes and~or other Objects)
</object>
and see 'Objects' above for (replacing the words logically): Verbs, Commands, Functions, Object Types (confusingly shortened to 'Types', argh), Timers, Turnscripts, and etc.
Attributes:
<attr name="xxx" type="xxx">Value</attr>
but with~for String Attributes:
example:
<attr name="condition" type="string">poisoned</attr>
are often shortened to this:
<condition>poisoned</condition>
and Script Attributes and~or Lists~Dictionaries, have a slightly different syntax, as they don't use the new syntax structure of ' <attr></attr> ', still using the old syntax structure of:
<NAME type="script">
(scripting)
</NAME>
mamessner
02 Dec 2014, 22:14Thanks so much. I played with the raw code a lot last night - first using the full game code editor before I realized you could code individual scripts. And yeah - I learned a lot by seeing how the code was translated back into GUI as well.