Stop a script from continuing

Avantar
15 Oct 2013, 21:12
Hi people,

I found Quest by accident and really find it incredible to the point where I would like to try and create a game. I do not understand any of the coding bits and thought I ask for some help. :oops:

I have the following basic structure for my Intro:
For the start script it calls my Intro

The intro structure:
play a sound file
print some text
wait 4 seconds then print some text
wait 6 seconds then print some text
ans so on...
pause game for x seconds
call character creation function

For those that find the intro boring and would want to skip it, I tried to add 'wait for key press (continue)' command
But on clicking the link or pressing any key - it will jump to the character creation part, but the intro script will still run and display the text every x seconds.

So I was wondering: How could I stop the intro script that is in progress all together and just carry on with the character creation? Stopping the sound file is no problem.

Any help in this regard would be appreciated. :wink:

HegemonKhan
16 Oct 2013, 00:30
Conceptually (Coding~Scripting Logic~Mentality~Thought-Process ~ it takes a while to train your brain to think in this way!):

---

think like this is an outline, in how you read (and understand) it, and it's order~proceedure

the numbers to the left is the order of what is done

1. I. Main Topic
2. I. A. Sub Topic
3. I. A. 1. Sub Sub Topic
4. I. A. 2. Sub Sub Topic
("5" won't start until the "2" script block is done: 2-4)
5. I. B. Sub Topic
6. I. B. 1. Sub Sub Topic
7. I. B. 2. Sub Sub Topic
("8" won't start until the "1" script block is done: 1-7)
8. II. Main Topic

---

msg ("Skip Intro?")
// game player chooses yes or no
// game engine automatically assigns "result" to the game player's choice:
// result = yes_or_no
if (result = no) {
-> // do the intro script block
}
// "call character creation function" script

--------

Practically (How to do this ~ how it should look):

Game (Object) -> Script (Tab) -> Start script ->

Add a~new script -> Output -> Ask a question -> [TEXT] -> "Skip Intro?" // or whatever~however you want to say it
After choosing, run a script:
-> Add a~new script -> Scripts -> If... -> [EXPRESSION] -> result = no
-> Then:
->-> Add a~new script -> ... -> "play a sound file" script(s)
->-> Add a~new script -> ... -> "print some text" script(s)
->-> Add a~new script -> ... -> "wait 4 seconds then print some text" script(s)
->-> Add a~new script -> ... -> "wait 6 seconds then print some text" script(s)
->-> Add a~new script -> ... -> "ans so on..." script(s)
->-> Add a~new script -> ... -> "pause game for x seconds" script(s)
-> Add Else If -> do NOT click on this "circle" button !!!! ~ do NOT add a script here !!!!
-> Add Else -> do NOT click on this "circle" button !!!! ~ do NOT add a script here !!!!
-> Add a~new script (this is inside the blue-colored box) -> ... -> "call character creation function" script
Add a~new script (this is outside of the blue-colored box) -> do NOT click on this "circle" button !!!! ~ do NOT add a script here !!!!

---------------

make sure you click on the right "circle" buttons, or it won't work !! you must follow my "nesting" or "indenting" (my arrows ON THE LEFT SIDE) exactly, by clicking on the correct "circle" buttons.

Avantar
16 Oct 2013, 04:08
Thank you a bunch for this detailed and informative solution! :D

I will certainly try this when I get off from work tonight.

jaynabonne
16 Oct 2013, 09:18
If you require further help, posting what you have so far would be helpful (and also further description of how the "press any key" would be used to skip the intro, etc).

Avantar
16 Oct 2013, 19:32
Thank you...

I wanted to upload the whole test file with the picture and it is a bit big for uploading here, so here is a link to download the file:
http://www.fileconvoy.com/dfl.php?id=g4 ... 86cb6bb522

I hope that is ok.

Jay...you will see I have used your 'map on/map off' commands. :D Thanx for that.
So for now, it still calls my old intro script - the way I had it.
The new intro file (NewIntro) function is supposedly to be the great reply I've got in great detail - I still managed to screw it up. :oops:

I have created this file for basically testing everything I should need to actually start the game - naturally the intro and character creation would be first in line and surely next would be the combat system.

I am already struggling with detailed descriptions...can only hope for the best going forward :?

I am really greatful for the knowledge you guys share for free.

Avantar
17 Oct 2013, 09:55

Add a~new script -> Output -> Ask a question -> [TEXT] -> "Skip Intro?" // or whatever~however you want to say it
After choosing, run a script:
-> Add a~new script -> Scripts -> If... -> [EXPRESSION] -> result = no



I think I found my problem - if I set "If... -> [EXPRESSION] -> result = false", instead of 'no' - it is all good.

Avantar
17 Oct 2013, 21:26
Just an update:

The 'Ask a question' output does not pause the game, but carries on to the first room where the player is located. So this was more what I was looking for:

msg ("Skip the Intro?")
get input {
ClearScreen
game.intro = result
if (game.intro = "no") {
SetBackgroundColour ("Black")
picture ("373672_bitva_rycar_pole_1680x1050_(www.GdeFon.ru).jpg")
play sound ("Interactive Book Intro.MP3", false, false)
SetTimeout (4) {
PrintCentered ("An adventure brought to you by JD Zeeman")
SetTimeout (6) {
PrintCentered ("Choose your path")
SetTimeout (6) {
PrintCentered ("Gain experience as you battle evil")
SetTimeout (6) {
PrintCentered ("Face peril at every turn!")
SetTimeout (6) {
PrintCentered ("Do you have what it takes?")
SetTimeout (6) {
PrintCentered ("Will you taste victory or your doom?")
SetTimeout (6) {
PrintCentered ("Then face your destiny and...")
SetTimeout (6) {
PrintCentered ("Restore the lost hope of a kingdom")
SetTimeout (6) {
PrintCentered ("Be a hero")
SetTimeout (6) {
PrintCentered ("Be....")
SetTimeout (7) {
PrintCentered ("Gothar's Hope")
}
}
}
}
}
}
}
}
}
}
}
Pause (71)
cc
}
else {
cc
}
}


So HegemonKhan was right in that you either run your desired script or just skip it all together. The above code did exactly what I wanted to achieve and I hope that it might help someone else.

HegemonKhan
17 Oct 2013, 23:50
my bad about the "result = no", I was trying to figure out how the "ask a question" script worked, and obviously didn't quite get it right, my apologies.

here's the script on it:

http://quest5.net/wiki/Ask_(script_command)

---------

if you want to use the "ask a question" script, you can, as you can use this script, "on ready", to make it wait, for your "ask a question" script to finish first:

http://quest5.net/wiki/On_ready

whatever script
on ready {
-> // this script will NOT run, until the above script finishes

Avantar
18 Oct 2013, 04:31
No Problem at all, HegemonKhan!

You have helped me immensely. Thank you for the reply, I will check it out.