Strange "Wait" Error [SOLVED]

Anonynn
21 Dec 2016, 08:28

I'm pretty used to operating with "wait/press to continue" scripts. I have a TON of them in my game. But...I'm coming across an error that isn't making sense to me. "Only one wait can be in progress at a time" which I completely understand but I don't get why it's happening because the waits are built inside of each other.

Here is a script below pertaining to one exit in a room I have.

msg ("text")
wait {
  msg ("text")
  player.variable= player.variable- 15
  BreakableItems
}

and here are the scripts in another exit of the same room.

msg ("text")
wait {
  if (player.variable>=7) {
    msg ("text")
    wait {
      MoveObject (player, Part 2)
    }
  }
  else {
    if (player.variable>=7) {
      msg ("text")
      player.variable= player.variable- 3
      wait {
        MoveObject (player, Part 2)
      }
    }
    else {
      msg ("text")
      player.variable= player.variable- 7
      BreakableItems
      wait {
        MoveObject (player, Part 2)
      }
    }
  }
}

Is anyone noticing something I'm not? I've gone through the scripts three times now.


The Pixie
21 Dec 2016, 10:29

I would guess the issue is moving the player. Is there a script that runs when the player enters "Part 2"? Or when the player leaves this room?


Anonynn
21 Dec 2016, 20:21

I thought that too. There was a wait on the entrance of the next room but first thing I did was remove it because I thought it was conflicting with the others. I'm still getting the error though. I also thought it might be because I had a wait on the script tab of the original room as well, but I don't. @_@


Jay Nabonne
22 Dec 2016, 21:13

Can you be more explicit about where these scripts are running? When you say they're related to exits, are they actually scripts attached to exits, so that they kick in when you are going through an exit?

It would be good to see what text is being printed when. If you have unique text being printed before each "wait", then you can know which wait is just being executed when the error occurs.

(Also, assuming "variable" is the same in all your branches, the "if" where you subtract 3 from "variable" will never be executed, as it's the same condition as the one above. Of course, you might have just posted generalized code, where "the names have been changed".)


Anonynn
23 Dec 2016, 17:39

Hey Jay! Great to see you around again! We missed you. Hope your holiday season has been going well :)

The scripts are running on specific exits, which are attached to "Run Script instead of moving the player automatically". And yes, I changed the names to protect the identities of the parties involved. :P I've been messing around with the scripting for the last few days. Here are the originals and what I changed so they work properly---I figured in case anyone else has a problem like this it would be a good reference.

Original Problem

msg ("text")
wait {
  msg ("text")
  player.variable= player.variable- 15
  BreakableItems
}

What I changed

msg ("")
player.variable= player.variable- 10
BreakableItems
msg ("")
wait {
  ClearScreen
  MoveObject (player, Part 2)
}

Original Problem 2

msg ("text")
wait {
  if (player.variable>=7) {
    msg ("text")
    wait {
      MoveObject (player, Part 2)
    }
  }
  else {
    if (player.variable>=7) {
      msg ("text")
      player.variable= player.variable- 3
      wait {
        MoveObject (player, Part 2)
      }
    }
    else {
      msg ("text")
      player.variable= player.variable- 7
      BreakableItems
      wait {
        MoveObject (player, Part 2)
      }
    }
  }
}

What I changed 2

ClearScreen
msg ("")
if (player.variable>=7) {
  msg ("")
  wait {
    ClearScreen
    MoveObject (player, Part 2)
  }
}
else {
  if (player.variable>=7) {
    msg ("")
    player.variable= player.variable- 3
    BreakableItems
    msg ("")
    wait {
      ClearScreen
      MoveObject (player, Part 2)
    }
  }
  else {
    msg ("")
    player.variable= player.variable- 7
    BreakableItems
    msg ("")
    wait {
      ClearScreen
      MoveObject (player, Part 2)
    }
  }
}

No other "waits" are attached to the room, or the proceeding room. Seems like the problem was when the "wait" was being placed before the big "If Scripts". I wondered if maybe the If Script isn't fully executing before the next "wait" inside of it was being called. No clue though.

^_^


Jay Nabonne
23 Dec 2016, 19:24

What does BreakableItems do?

You can have the wait problem if "wait" is being called from multiple places which are all running together. It might very well not be the waits within the script you showed above. For example, if BreakableItems had its own wait, then you'd have a problem. Or if some other script was running for some other reason (turn script, etc) that called "wait", then you'd have a problem. The code you have shown so far doesn't seem to have an error that I can see, and I don't know why the change you made would make a difference. (Of course, it could also be a Quest bug, in which case all bets are off for reasonable behavior! :) )

And I hope your holidays are going well, too!


Anonynn
23 Dec 2016, 20:25

BreakableItems is a Function with a large "if script" which makes all breakable items in the player's inventory have a 35% chance of breaking when called. There is no "wait" script in it's coding.

And yeah, that's why I removed the "wait" from the following room, I figured it was conflicting with another "wait". Pixie thought that might be the case as well, but I had already removed any waits in the room (which the exits are attached to), and the following room (where the exits take the player). But nope, no other "wait" scripts are in the turn-scripts I have running, as other problems would cropped up where I have similar code.

I think perhaps it could be a bug because I didn't notice any problems either, hence why I created the post! Maybe if the "wait" leads into an "if expression of variables" that have multiple outcomes (each with a "wait" embedded inside) then first "wait" can't finish its execution.

What do you think?


hegemonkhan
24 Dec 2016, 08:23

definately a good idea, whenever you have a problem with something, look for all instances/uses of that something in your code causing the issue/s, as, as Jay said, multiple scriptings can be running at the exact same time, which you may not be aware of - as it may not be were you think it's cause it located at - hence searching for all instances/uses of that something causing the issue).

This is why we often ask/need to see people's full game code.