Error when talking with any NPC.

K

kestus0756

Guest
Hey again, why do I get this error when I try to talk with NPC in my RPG game?

___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_dialog:

string_width argument 1 incorrect type (0) expecting a String (YYGS)
at gml_Object_obj_dialog_DrawGUI_1 (line 9) - if (string_width(text_words) >= width-(margin*2)) {
############################################################################################

Help would be appreciated a lot as always.
 

NightFrost

Member
And what code should I replace?
The one that puts numbers instead of letters into text_words variable. Go through your code and check lines that put something into the variable, and ensure what is being inserted is actually a string. If you are dealing in numbers (like score) you should use string() on the content when inserting it to the variable.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Is it just me or is it weird that the compiler complains about argument 1 and not argument 0? Isn't it supposed to be consistent with the terminology in the rest of GM?
 

Genetix

Member
Another thing to check - when you first set or initialize the variable "text_words" are you setting it as a string value or a numerical value?

ex: text_words = "" or text_words = 0
 
Top