Using labels.

Deleted member 416612

The 'landlord'
Donor
Game Developer
Feb 2, 2018
924
3,922
Holla,

I finished making a menu with different scenes. The idea of the menu was the following:
The menu has three values from which the user can select.
If the user will select value A then after he is redirected to the label A, when returning upon the menu, the other two values would be available for selection without the one previously select. When he selected the other values as there would be nothing to select from, the user will be redirected to another part in the game.
I've used the following code:

default hall_set = []

menu hall:
set hall_set
"visit [A]":
jump A_scene
"visit ":
jump B_scene
"visit [C]":
jump C_scene

jump after_menu

#If the user will select A, the game should be redirected to this scene:

label A_scene:
"Cuba Libre"
return hall

So without the "jump after_menu" label, I will be sending the user into a loop from which he can't exit.
Le question: Is it ok for me to use the label for exiting the loop? I am asking this because I don't know if further into the game there will be a downside for using too many labels (except maybe for confusion).
If there is a downside to this, how can I exit the loop without the two pills from Matrix?

Thanks
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,426
15,333
Le question: Is it ok for me to use the label for exiting the loop?
Yes.

But contrarily to what you said, the code you gave will not generate an endless loop. You jump to "label_A", and you return from it. It will send the player to an undetermined location depending of the last unreturned called label.
 

Deleted member 416612

The 'landlord'
Donor
Game Developer
Feb 2, 2018
924
3,922
Yes.

But contrarily to what you said, the code you gave will not generate an endless loop. You jump to "label_A", and you return from it. It will send the player to an undetermined location depending of the last unreturned called label.
Thanks mate!
I don't know how but using that code would generate somehow a loop. When the player would select the final option, it would send the player into a neverending scene ( After the player would reach the end of the scene, the scene would start again).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,426
15,333
Thanks mate!
I don't know how but using that code would generate somehow a loop. When the player would select the final option, it would send the player into a neverending scene ( After the player would reach the end of the scene, the scene would start again).
It's probably because of the return that have nothing to do here since you jumped to the label. Correct the error and it should works as expected.