• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Variables in room editor don't read string?

Hi,
I started editing a simple textbox for the dialogues between PG and PNG. to avoid having to write code for each dialogue I wanted to use the variable management in the room editor.
variables in room editor 01.png
but I can't get it to work. am I wrong or is there a bug? the door management between one room and another works
here code of textbox object
GML:
if testo_dialogo == ""
{
   testo_dialogo = "proprietario "+string(proprietario);
}
step event
//show_debug_message("proprietario "+string(proprietario.id));
if keyboard_check_pressed(vk_backspace)//aalora a funzionare funziona, il problema è che non ho una keyboard sul telefono
{
    if (pag+1 < array_length_1d(testo_dialogo))
        pag +=1;    //quindi farò con l'event del tap da cellulare
    else
        instance_destroy();
}
   
draw event

draw_sprite(s_box_dialogo,0, ascissaBox, ordinataBox);

draw_text_ext(ascissaBox+5,ordinataBox-altezzaBox, testo_dialogo[pag], altezzaTesto, larghezzaBox);
and in mobile PNG
Code:
step event
#region sequenza dialoghi

        if box_dialogo == noone
        {
            box_dialogo = instance_create_layer(x,y,"tile_sovrapposto", o_box_dialogo);
            box_dialogo.proprietario = instance_nearest(x,y,o_PeasantMobile);
            box_dialogo.testo_dialogo = dialogo;
        //    show_debug_message("props"+string(box_dialogo.proprietario));
        }

       
        //crea_box_dialogo(o_box_dialogo, self, other);
        #endregion
       
       
                if not place_meeting(x,y, o_PlayerMobile)
                {
                    staDialogando = false;
                    instance_destroy(box_dialogo);
                    box_dialogo = noone;
                    statoazione = azione.alpasso;
                    sprite_index = SpriteAttesa;
                    image_index = 0;
                }
    #endregion

create event
box_dialogo = noone;
dialoghi_lunghi = false;
staDialogando = false;
dialogo[0] ="";//if i write something here it shows it correctly
dialogo[1] ="";//if i write something here it shows it correctly
dialogo[2] ="";//if i write something here it shows it correctly
dialogo[3] ="";//if i write something here it shows it correctly
thanks for aids
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I'm pretty sure you need to put the contents of the variables in quotes "", like you would in code. The string identifier in the object variables editor doesn't do this for you and is there more as a help to team members who are editing the rooms (like artists or level designers) so they know that this is the case.
 

Yal

🐧 *penguin noises*
GMC Elder
I think having string variables without quotes would work, I'm more inclined to think that the array syntax is the issue. (Variable names with the symbols "[" / "]" in them are illegal so they aren't created properly). The List (with multi-select turned on) or Expression variable types can be used to create arrays in a more stable way, but without vertical scrolling they can be a bit messy to deal with. Using Instance Creation Code could also work (define the variable contents with GML), Creation Code is run after the Create Event (which is run after GUI variables are defined) so this shouldn't cause any conflicts with the default values.
 
even with "" and without array don't run.
i've seen the method for insert text in a tutorial at this link
in the first 9 minutes. honestly i don't know how it's possible. however setting "variables" in room_edito doesn't work just before i add pag+1 and similarray variables and i've used dialogo1 = ""; dialogo2=""; etc... in creation event.
 
I think having string variables without quotes would work, I'm more inclined to think that the array syntax is the issue. (Variable names with the symbols "[" / "]" in them are illegal so they aren't created properly). The List (with multi-select turned on) or Expression variable types can be used to create arrays in a more stable way, but without vertical scrolling they can be a bit messy to deal with. Using Instance Creation Code could also work (define the variable contents with GML), Creation Code is run after the Create Event (which is run after GUI variables are defined) so this shouldn't cause any conflicts with the default values.
with Instance Creation Code works even with this array method i've copied from that tutorial. Thks!!
 
Top