Help using basic variables

First timer here!
so I want to know how to use if and else and how to return to the previous choices.
now there is a room you can’t enter it without an item and if you have the said item you can go in.
I don’t how to put it in code.
please help!
and thanks for the help!

1 Like

Your best bet here is something like this:

*label repeat01
You encounter a door with a lock.
    #Open door (requires key) 
        *if has_key = true
            You use the key and unlock the door.
            *goto inside_door
            You do not have the key, so you are unable to unlock the door.
            *goto repeat01
        *goto repeat
*label inside_door

This would allow you to set up a simple locked door, where if the variable that checks if the player has the key is true, then they can enter the room. Hope this helps.

But i urge you to look at the welcome thread, as it contains a bunch of useful links and tutorials and the like.

1 Like

thank you so much!

1 Like

i have problem, I wanted to make inventory, and have them use it. now the choices the said items are hidden [the choice are in stat] so if they choice the stats it will show {nothing to select} I don’t know how to connet ite ms to choice like if item true the choice otherwise it stays hidden.
*create health 100

*create invantory_use false

*create item_one false
*create item_one_name “”
*create num_item_one 0

*create item_two false
*create item_two_name “”
*create num_item_two 0

*create item_three false
*create item_three_name “”
*create num_item_three 0

*create item_four false
*create item_four_name “”
*create num_item_four 0

*label items
#obtain item one
*set health -50
*set item_one true
*set item_one_name “flash”
*set num_item_one +1
*gosub items
#obtain item two
*set item_two true
*set item_two_name “back bag”
*set item_one_name “flash”
*set num_item_two +3
*set num_item_one +1
*gosub items
#obtain item three
*set item_three true
*set item_three_name “candle box”
*set num_item_three +5
*gosub items
#obtain item four
*set item_four true
*set item_four_name “match box”
*set num_item_four +3
*gosub items
*temp stat_page 0
*label main_stat_page
percent health


*if (item_one =true)
*set invantory_use true
${item_one_name} :

*if (item_one = true)


*if (item_two =true)
*set invantory_use true
${item_two_name} :
*if (item_two = true)

*if (item_three = true)
*set invantory_use true
${item_three_name} :
*if (item_three = true)

*if (item_four = true)
*set invantory_use true
${item_four_name} :
*if (item_four = true)

*if (invantory_use = true)


*if (item_one = true ) #use item one
    *set num_item_one -1
    *if (num_item_one =0)
        *set item_one false
    *goto main_stat_page 
*if (item_two = true ) #use item two
    *set num_item_two -1
    *if (num_item_two = 0)
        *set item_two false
    *goto main_stat_page
*if (item_three = true ) #use item three
    *set num_item_three -1
    *if (num_item_three =0)
        *set item_three false
    *goto main_stat_page
*if (item_four = true ) #use item four
    *set num_item_four -1
    *if (num_item_four =0)
    *goto main_stat_page

Hm… What is the necessity in true or false. You can use an

if (item_number > 0)

To set if the Item is visible or not.

Also, there is a inventory system ready in This Link!

Why you don’t take a look?

1 Like

Thank you
You are right I should have used number instead of true or false

1 Like