Odd error working with choicescript_stat


#1

Sorry a little longish here
I have in the startup

*create file_deleted false

Then in choicescript_stat at the very top

*if (file_deleted)
 Text is here
 *finish
*if not (file_deleted)
 *goto step_3

On the startup I set the var true it displays the message. Set it false and it goes on to the next label. Everything seems well in the land of CS, not so says I.

I put it in a choice as such

Text
*choice
 #Proceed
  More text
  *set file_deleted true
  *goto_scene location
 #Do nothing
  *goto_scenescript_stat step_1

I click proceed then the stat button thinking I will get the text message that I reviewed when testing the true false with just the created stat. Aw but no it ignores what I have done and goes on to step_3. Now I know I am not the greatest programmer here but this is fairly straight forward and is bugging the crap out of me. Any help would be very welcome, thank you.


#2

It all looks fine to me, except for this odd line:

*goto_scenescript_stat step_1

But that wouldn’t be the cause of the problem you’ve encountered there… The only thing I can think of would be something in file location itself, e.g. if in there you had a:

*set file_deleted false

on the first page for some reason… Beyond that vague possibility, I must admit I’m stumped too. :confused:


#3

@Vendetta
I original had the choice set on the stat page thinking it was an odd behavior on the the stat page I moved it to the startup page with the same odd error, well not error just ignoring the true statement.
As far as the location page it has only one simple if statement taking you back to the last page you were on. Some of the code I am writing I cannot use a gosub comand so it takes you to the last location in the same manor as a gosub. Thanks for looking.


#4

When I run it through CSIDE as a test project it actually works exactly as you intend - the only difference is I don’t have your extra code (obviously!) so in my location file I just had some plain text… I’m definitely leaning towards your problem maybe being that *if you have in there. Perhaps *comment that out temporarily and see what happens?

Edit: for example, if that *if in location ends with a *goto_scene startup (but without a label to skip the variable creations) then it will definitely be resetting *create file_deleted false.


#5

I keep seeing people using *finish mid-code. Why would you need that command unless it’s at the end of a scene file? Wouldn’t a *goto label work to skip whatever you’re intending?


#6

*finish tells CS to end the scene now (skipping anything else in this scene) and load the next sequential file listed in *scene_list in the startup file. *goto_scene would be the other alternative, if wanting to head somewhere other than the next scene in the list.


#7

Thanks, that helps. But how would *finish work on the stat screen, since choicescript_stats isn’t in the scene list?


#8

It displays a ‘Next’ button, which when clicked returns the player back to the narrative scene, so effectively cuts off everything you might have scripted below it (hence using it only for conditional purposes on that screen - e.g. you might not want to display a particular range of stats - or any - until later in the game).


#9

Thanks having to roll the next few days so maybe a bit before I can retest.