X
XirmiX
Guest
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_textbox:
file_exists argument 1 incorrect type (0) expecting a String (YYGS)
at gml_Script_scr_register_handling (line 11) - else if file_exists(user_name)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_register_handling (line 11)
called from - gml_Object_obj_textbox_StepNormalEvent_1 (line 16) - scr_register_handling(noone, noone, txt);
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_textbox:
file_exists argument 1 incorrect type (0) expecting a String (YYGS)
at gml_Script_scr_register_handling (line 11) - else if file_exists(user_name)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_register_handling (line 11)
called from - gml_Object_obj_textbox_StepNormalEvent_1 (line 16) - scr_register_handling(noone, noone, txt);
Essentially, you type in a string of characters in text boxes. There are two variables being used, both of which are, at the beginning, declared as strings. At the end of it all, only one of them gets sent off to a script, but even then, both are strings, always were, always will be. Yet, for some reason, this script doesn't recognise them as strings. Why?! Here's relevant code:
Textbox creation code:
Code:
self.selected = false;
self.max_char = 30;
self.char_written = 0;
txt = "";
tt = "";
enter_string = 0;
leftX = x - (sprite_width/2);
topY = y - (sprite_width/2);
rightX = x + (sprite_width/2);
bottomY = y + (sprite_height/2);
Code:
draw_self();
draw_set_colour(c_lime);
//draw_text(x-56, y, txt);
if self.selected == true
{
tt = keyboard_string;//set keyboard string to a temp var
//make sure it doesnt go over the desired length
if (string_length(tt) > 30)
{
//if it does go over we set it back to the correct length
keyboard_string = string_copy(tt, 1, 30);
txt = tt;
}
//these are just to update text variable (this is the variable to hold the key string value)
var update_keys = keyboard_check_pressed(vk_backspace) || keyboard_check_pressed(vk_enter);
if (update_keys)
{
txt = tt;
}
txt = tt;
draw_text(x-56, y, tt);//draw the text
}
else
{
draw_text(x-56, y, txt);//this is the text when not selected
}
Code:
///Checking instance id for sending text where needed
{
if keyboard_check(vk_enter)
{
switch(self.enter_string)
{
case 1: //username register
scr_register_handling(txt);
break;
case 2: //password register
scr_register_handling(noone, txt);
break;
case 3: //password confirmation
scr_register_handling(noone, noone, txt);
break;
case 4: //username login
scr_login_handling(txt);
obj_dataholder.logged_username = txt;
break;
case 5: //password login
scr_login_handling(noone, txt);
break;
}
}
}
Code:
//Sets the three registration values as arguments
{
user_name = argument[0];
pass_word = argument[1];
pass_word_confirm = argument[2];
if (user_name == "")
{
scr_message_display("Please enter a username")
}
else if file_exists(user_name)
{
scr_message_display("Username has already been taken by someone using your machine");
}
else
{
if (pass_word != pass_word_confirm)
{
scr_message_display("Confirmation password does not match the password you entered")
}
else
{
//irrelevant code, not showing this :P
}
}
}
Then for the three textbox instances that are in the room, they have the variable "enter_string" (declared in create event code) set to 1, 2 and 3 respectively, and I checked!
My only guess would be that it has something to do with the fact that the text is written in a draw event and not a step event... But even then, the variables are declared as strings in create event, so what the hell?