Using a variable: goto_scene variable

I asked in an old topic but decided to move it back here. Due to my game mechanics I have very detailed sub.

So in matches instead of using

*if (friendly01)
  *goto_scene friendly01match tzone
*if (friendly02)
  *goto_scene friendly02match tzone
*if (game1)
  *goto_scne game1 tzone

I want to use a variable

*temp Scene_name
.OR
*create Scene_name "unknown" / ""   (no save created, after the scene it can be blank again)

So I will only write at the beginning of the scene

*if (friendly1)
 *set Scene_name  ${friendly01match}
*if (game1)
  *set Scene_name ${game1scene}

so at the dozen instances down I won’t have to repeat the first code piece I shared.

I think my error is on syntaxes. I even tried to console log with this :

*if (friendly01)
  *set Scene_name friendly01match

[b][i]Matchsubroutine scene name is ${Scene_name}[/i][/b]

it was either unknown or blank nothing after I read Matchsubroutine scene name is …

Any ideas appreciated :smiley:

so I can only use
*goto_scene Scene_name tzone

instead of dozen lines in each instances

last nights post

Not sure if correct place but asking here:

Realized something in my sub , I actually want to change a value name to fit it with scenes.

I used redirect inbetween story scene and gosub scene several times.
instead of writing manually on every instance.

*if(friendly01match)
  *goto_scene friendly01match tzone
*if(game2)
   *goto_scene game2 tzone

several times so to make it practical I wanted to add this changes:

*if (friendly01match)
  *set Scene_name "$!{friendly01match}"

so on gosub at top I set Scene_name value I created at the startup with
Scene_name “unknown” didn’t work.

So what I want to do is when each boolean gets true for matchs I want the “Scene_name” to change to given scene name - if game1 friendly01match
if game to proper scene name etc.

*goto_scene Scene_name tzone
so this command will direct me to given scene, I tried using{} or even but I was away for a while and don’t sure on syntax required for it.

*How can I make it in CSIDE?
so
`

``
*goto_scene Scene_name tzone
will act as
*goto_scene friendly01match tzone

Assuming that friendly01match and game1scene have scene names and tzone contains the label to be called, try this:

*if (friendly1)
 *set Scene_name friendly01match
*if (game1)
  *set Scene_name game1scene

(…)

*goto_scene {Scene_name} {tzone}

1 Like

If you want to use *goto_scene, better use variables created in startup file, because temp variables don’t carry between scenes;

*if (friendly1)
	*set Scene_name "friendly01match"
	*goto next
*elseif (game1)
	*set Scene_name "game1scene"
	*goto next
*else
	*bug Incorrect scene name: ${scene_name}
*label next
*goto_scene {scene_name} tzone

This should work, as long an all name variables and indentation are correct.
*buf command will help you catch iccorrectly named variables.

1 Like

Thanks,It will come handy ^^

Also I realized after the practice - the gosub is faulty.
So I came up with the idea of using the daily dates with a calendar variable
it seems to be working.
After few checks will publish and check your solution - thanks @Kotosinica @nocturno

*comment *if return_to_scene = "morningm15"
*if calendar = 15
  *goto_scene morningm15  endmorningmeeting

*comment *if return_to_scene = "after1stgame"
*if calendar = 20
  *goto_scene after1stgame training_report
  *comment set calender 20
 
*comment *if return_to_scene = "anewdawn"
*if calendar = 22
  *goto_scene anewdawn training_complete
  *comment set calendar 22


*comment *if return_to_scene = "path_phonebook"
*if calendar = 22.5
  *goto_scene path_phonebook decision_making
  *comment set calendar 22,5

1 Like