How to print different messages based on if a timescript is running

Basically I have a command computer that 3D prints an object which takes a certain amount of in-game time. It relies on a general timescript called "printing psi harness". Of course, if it's already in the middle of printing, you shouldn't have the opportunity to print again. So I need to use an If Script so that if the Timescript is already running, then it'll print a message saying that the device is already in use. I've guessed it'll probably be an expression under If but I'm not sure what it'd be. A variable with printing psi harness = ?????? Or is it something else? Any ideas?

And yes, I know 45 minutes is a helluva long time but I'm actually using this game as a way of running certain small team-oriented sessions in a larger real world game (LARP) so lengthy time spans are fine. I'll eventually re-jig this into being a standalone game, at which point I'll reduce the timescript to something far more manageable.

if (printing psi harness = ???????) {
  msg ("Something is already printing.  You'll have to wait until it's finished.")
}
else {
  msg ("Apparently they had been in the middle of constructing a psi-harness (whatever that is) when the last user had logged in -- but they were unable to complete it due to lack of yellow chems.  It looks like they needed at least 12 doses of the stuff.  The other ingredients are already in place -- various other chemicals with really long names that aren't as commonly used as the colour name brands.  You could probably finish it off but you're not sure what the point would be.")
  Ask ("Would you like to spend 12 yellow chems and create a psi-harness?  If so, select yes and place 12 doses of yellow chems in the OOC box.") {
    if (result) {
      msg ("Please enjoy your psi-harness.  Whatever that may be.  It will take 45 minutes for the item to be produced.  Once it has been built, you will find it inside the 3D printer.")
      EnableTimer (printing psi harness)
    }
    else {
      msg ("Nevermind then!")
    }
  }
}

K.V.

You can set an attribute on the printer when you set the timer, then put a line in the timer that sets the attribute back.

Let's say the object's name is printer. First, make sure you set up the attribute on the printer.

You can do this in the game's start script whether you are creating you're game online or in the desktop version, so that's the way I'll do it here.

Add this line to the start script:

printer.printing = false

Then, in the script where you set the timer, add this line (which I've already added in my version of the example you posted, which is coming up in this post):

printer.printing = true

Then, add this line in your timer's script:

printer.printing = false

Now, you can edit the script you posted:

if (printer.printing) {
  msg ("Something is already printing.  You'll have to wait until it's finished.")
}
else {
  msg ("Apparently they had been in the middle of constructing a psi-harness (whatever that is) when the last user had logged in -- but they were unable to complete it due to lack of yellow chems.  It looks like they needed at least 12 doses of the stuff.  The other ingredients are already in place -- various other chemicals with really long names that aren't as commonly used as the colour name brands.  You could probably finish it off but you're not sure what the point would be.")
  Ask ("Would you like to spend 12 yellow chems and create a psi-harness?  If so, select yes and place 12 doses of yellow chems in the OOC box.") {
    if (result) {
      msg ("Please enjoy your psi-harness.  Whatever that may be.  It will take 45 minutes for the item to be produced.  Once it has been built, you will find it inside the 3D printer.")
      EnableTimer (printing psi harness)
      printer.printing = true
    }
    else {
      msg ("Nevermind then!")
    }
  }
}

So simple! I'm slowly getting the hang of thinking of these various components and how you can use them. Thanks so much! I should've thought of putting an attribute on the object. :D


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums