Help to code with the if function !

Hi everyone !
I would like to finish my second game, but I have a problem with "coding". It's a gamebook game.
I would like that when the player visited a page, when I suggest the different directions, the game no longer displays the same page. Otherwise, the game will loop endlessly ^^

I think it's with the "if" function but I don't know how to set it up ...
Thank you ! <3

I'll try my best to understand you're question. To use the if function you click on the add script button, then click if. Then you run whatever script you want to happen if something specific happens.

However, I'm not sure you need to use the if function in your case

What I think you are trying to do is get a 'new page' when the player has to choose. What you really need is the clear screen. This clears everything that happened before. Then, if you switch function, so when the player picks options and they lead somewhere, bad, you can restart the game, but only if the bad choice is picked. You can either end the game and make them start over or you can clear the screen and present the choices again. That way, if the good choice is picked, they can continue playing without going on a loop. The code would look something like this:

ShowMenu (""Which direction do you pick?"", split ("left;right" , ";"), false) {
switch (result) {
case ("left") {
MoveObject (player, leftroom)
msg ("You went left!")
case ("right") {
MoveObject (player, rightroom)
msg ("You go right!")
default {
error (""You must input 'left' or 'right' no other options will suffice"")

I hope I helped, if you have any questions just ask :)

If I'm understanding the question, I think what you want to do is have a script on each page that removes the link that points there from the "choice" page. That should be simple enough, just a single script on each page.

Log in to post a reply.