Try attaching

Hi all,
I have set up a series of "run script after x seconds" in a cluster of rooms, which force the player to keep moving between rooms before the countdown expires in order to escape it each time. However, the countdown continues after players have left the room and it just stacks infinitely on top of any new ones activated.

I tried attaching an If player is in room requirement to the scripts, but it still continues running if they leave it does not make the script independent of that room. Is there any way I can shut down the scripts after the player leaves the room they are in, preferably with built in functions as opposed to manually written scripts.
Thanks

Doan


I already posted a pretty long answer to this question.

Not sure if you've posted the same message before and not read the answers, or if this is a spambot repeating old posts. Can someone find the original post?


This must be the post that mrangel is referring to:

http://textadventures.co.uk/forum/quest/topic/xct1f1uxzeomp1-tnbsbow/tried-attaching

Strange though, I found another post like this going back to 2016:

https://textadventures.co.uk/forum/quest/topic/ew5aczqvm0mylmzgle9aka/stop-script-after-leaving-a-room


Timer scripts are a huge pain in the ass. I’m pretty sure I needed to run multiple intervals to make it work. The problem is that once a timer starts, it always runs to completion even if you turn it off. At least that is how I remember it.

I’m not at my home pc right now but I will check when I get there and post how I got a similar thing done. Give me a couple days.

Happy gaming!


I apologize. I had such a shitty time with it (pun intended) that I turned it into a turnscript instead of a timer. EDIT: See below. This may help?

if (GetBoolean(Xanadu, "healthy")) {
  Xanadu.sickcount = 0
}
else {
  if (Xanadu.sickcount = 2) {
    msg ("----<br/>Your mouth, tongue, and throat have this odd, tingling sensation.")
  }
  else if (Xanadu.sickcount = 5) {
    msg ("----<br/>Aside from the tingly sensation in your mouth and throat, it now feels like little, drunk gymnasts are doing flips and twists in your gut.  In doing so, those little gymnasts are somehow also playing an odd assortment of instruments that make some of the strangest gurgling, burbling, and sloshing sounds you have ever heard.  Perhaps you should find your way to a restroom?")
  }
  else if (Xanadu.sickcount = 8) {
    msg ("----<br/><i>'Oh, Dear Eight Pound, Six Ounce, Newborn Baby Jesus, in your golden, fleece diapers...'</i> you mutter as you begin your prayers.  The twirling in your stomach has escalated to an all out riot.  Whatever is in there, is fighting violently to get out.  Your esophageal and anal sphincters are now on all out 'pucker mode'.  Sweat has beaded on your brow.  It is a cold and unwelcome sweat.  You really, really, really need to find a restroom.")
  }
  else if (Xanadu.sickcount = 12) {
    msg ("---<br/>You can no longer swallow your bathroom pride...<br/><br/>You drop your pants immediately where you stand.  Before they hit the floor, the eruptions begin.  There is so much leaving your body (from both ends), you quickly dehydrate and become disoriented.  You stumble around, slipping in wet puddles.  You remember dancing lights and spinning rooms.  You stumble into a cold room and pass out...<br/>---")
    SetObjectFlagOn (Xanadu, "healthy")
    AddToInventory (rotten food)
    play sound ("fart.wav", false, false)
    MoveObject (Xanadu, Prison Cell)
  }
  else {
    if (game.pov.parent = farthest stall) {
      play sound ("fart.wav", false, false)
      msg ("---<br/>With your knees crossed coupled with your difficulty in standing up straight, you are having a hard time getting your pants down.<br/><br/>Just in the nick of time, you do get your pants opened up and you drop them to the floor...<br/><br/>Before you can sit down, however, the dam breaks and the flood gates open.  At first, it just sounds like a high pressure fire hose.  Sprinkled in are some odd toots and squeaks as the sulfurous emission continues.  At the tail end (no pun intended) of your fecal display, the cacophony of noises erupts into a crescendo of honks, bloots, ka-phroops, slurps, and fizzles.  Just when you thought the misery was over, the vomiting begins.  The projectile barf flies forth in a fancy array of colors.  The explosiveness of it all is enough to make Mt. Pinatubo blush.  You hurl, spew, chowdergargle, and blow chunks.  You upchuck one last time and wipe your mouth on your sleeve.  At least you are feeling a little better now.<br/><br/>You wipe your bleary, wet eyes and take in your surroundings.<br/>---")
      wait {
        msg ("---<br/>Wow.  Disgusting.  I can't even describe how unclean this stall is.  There are colors and smells and textures in here that go beyond rational explanation.  Is it possible to hold this much filth in one human stomach?  Wait... You don't remember eating anything that was neon green.  How did shit get on the ceiling?  <br/><br/>Anyway, you sheepishly back out of the stall, disappear from the restroom, and sneak off down the hallway to avoid embarrassment.  Although you feel sorry for whatever poor soul has to clean this up, you hope it gets done pretty quickly.  Ick...<br/>---")
        DisableTurnScript (sickturnscript)
        MoveObject (rotten food, Item Warehouse 1)
        IncreaseScore (10)
        Xanadu.score = Xanadu.score + 10
        MoveObject (Xanadu, Long Hallway)
        UnlockExit (JCLock)
        SetObjectFlagOn (Xanadu, "healthy")
        SetObjectFlagOn (farthest stall, "unclean")
        MoveObject (janitors cart, Filthy Restroom)
      }
    }
  }
  Xanadu.sickcount = Xanadu.sickcount + 1
}

I did find this in X1:

  <timer name="SC Timer 1">
    <interval>10</interval>
    <script><![CDATA[
      msg ("<br/>The sliver of light seems to have crept a bit across the cave floor.<br/>")
      JS.scrollToEnd ()
      DisableTimer (SC Timer 1)
    ]]></script>
  </timer>
  <timer name="SC Timer 2">
    <interval>20</interval>
    <script><![CDATA[
      msg ("<br/>Yep.  The sliver of light is definitely moving.  It is nearly to the back of the small cave.<br/>")
      JS.scrollToEnd ()
      DisableTimer (SC Timer 2)
    ]]></script>
  </timer>
  <timer name="SC Timer 3">
    <interval>30</interval>
    <script><![CDATA[
      if (not GetBoolean(shovel, "shovelinv")) {
        msg ("The sliver of light has now extended all of the way across the floor of the cave.  You follow the light to the back of the cave and notice a glint reflecting back at you.")
        JS.scrollToEnd ()
        MakeObjectVisible (glint of light)
        JS.scrollToEnd ()
      }
      if (GetBoolean(shovel, "shovelinv")) {
        msg ("<br/>The sliver of light has now extended all of the way across the floor of the cave.<br/>")
      }
      JS.scrollToEnd ()
      DisableTimer (SC Timer 3)
    ]]></script>
  </timer>

Log in to post a reply.

Support

Forums