Variables without a choice

Morning folks.

I’m trying to set up a system in the WIP I’m doing where it will automatically direct a player to a specific scene after X variable becomes… well… X actually.

A better way to phrase this is I’m looking for the character to be sent someplace after a certain amount of “time” has passed without the need for the user to input a *choice selection (though choices would be what’s passing the time).

Is there a cleaner way to do this? I currently have this variable: *create time 60

The time variable is used in a few other places but it’s mostly abstract in those areas and leads to a different scene WHEN THE USER CLICKS A CHOICE rather than “when time = x”.

The best I could come up with was putting *if (Time = X) at the end of every scene’s last page break but I’m hoping there’s a cleaner way to do this.

To clarify:
Do you want the player to be able to do thing between point A and B?

Cause then you can go with a

*temp time 5
and
*set time -1
at the choices and a 
*if (time !=0)
   *goto choices
*else
   *goto thisscene
2 Likes

I’m basically looking for them to pick a number of choices and then the scene automatically shift at the end of the scene if the time reaches 0.

*label choices
*choice
   *hide_reuse #option1
      *set time -1
      *goto scene1
   *hide_reuse #option2
      *set time -1
      *goto scene2
   *hide_reuse #option3
      *set time -1
      *goto scene3
   *hide_reuse #option4
      *set time -1
      *goto scene4
   *hide_reuse #option5
      *set time -1
      *goto scene5

*label scene1
text and stuff
*if (time =0)
   *goto newscene
*else
   *goto choices

if CS protests that 0 is not a positive number you can also use
*set time +1

and have it be
*if (time =5)

1 Like

Ouch. That’s what I thought I’d have to end up using. I was hoping there would be a more clean way to implement it. Thanks anyways.

1 Like

While we’re here btw.

That was strange.

Anyways, while we’re here, is there a way to compare variables and have C-Script select the highest one?

There isn’t a built-in operator for it afaik but you could build it in a gosub (or gosub_scene) and call it whenever it’s required

Thanks.

CSLIB has a great tool for that! I think MAX_STAT is the one you’re looking for in this file. Just copy and paste the lines from *comment MAX_STAT to *goto _max_stat_loop into a new scene file, and you should be good.

5 Likes