Help with something.

PoiYo
13 Oct 2020, 13:08

So I want to add an event where you have to do a certain action a certain number of times in a time limit to win.

What's the best way to implement that? I know how to do the timer, and I know that it has to do something with Turn Scripts, but I can't wrap my head around it.

Update : Messing around I found out about "Run Script after number of turns" command. It fixes one of my problems, but it arises a new one. I cannot find a way to disable it once it's function is done. I want it to play a message and send me back to a room, which it does. The problem with it is that now every other movement has it play the message and move me back, soft locking me. I tried both "Disable turn script" and "Suppress turn scripts" but they don't work. Any way to fix this?


PoiYo
13 Oct 2020, 22:39

No? No one's gonna help?


Forgewright
13 Oct 2020, 23:34

Shoot Command

Let's say you have to shoot something 10 times in 20 sec.
Each time you shoot it, an attribute on the object is increased by one.

object.shots = object.shots + 1
SetTimeout (20) {
  if (object.shots >= 20) {
    msg ("You win.")
  }
  else {
    msg ("You lose.")
  }
}
Not a great coder so this is where I'd start.


mrangel
14 Oct 2020, 00:01

You'd probably want to start the timer when the competition starts, rather than when you shoot. Otherwise you'd end up with several timers running.

But that's pretty much the basic structure. If you want a more detailed response, you'll need to say more about what you actually want it to do.


Forgewright
14 Oct 2020, 01:24

Right!