• 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!

String in script arguments?

D

DIF Studios

Guest
Hello, so I'm doing a suuuuuuper simple text box.Basically I have an invisible controller for the text system in the room, and any time I need it to show up, I just change the currenttext variable and it draws whatever text I tell it to. The only way I can really make it work is through scripts. Only problem is, I'm trying to use a string as one of the arguments and every time I do I get this error:


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Mouse Event for Right Button
for object testobj:

Unable to find any instance for object index '3'
at gml_Script_textscript (line 1) - text_controller.show=argument0;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_textscript (line 1)
called from - gml_Object_testobj_RightButtonDown_1 (line 1) - textscript(1,"did it work?");
________________________________________________________________________________________

So here's the script (Again, it's a very, extremely simple textbox.)
Code:
textbox_obj.currenttext=argument0;
And here's how I execute the script (Used in various objects)
textscript("Test Text");

I've tested the text box on it's own, just to make sure that the script is the problem and not something else in the text box's controller.
Basically what I'm getting from this, is you can't use strings in arguments, or I'm doing something else dumb.

Any and all input is greatly appreciated :)
 

Binsk

Member
There is no instance of textbox_obj in existence when you are calling the script. That is the issue.
 
D

DIF Studios

Guest
There is no instance of textbox_obj in existence when you are calling the script. That is the issue.
Oh duh I freaking forgot to put the controller in the room son of a hell I'm literally the stupidest person ever XD
 
C

CedSharp

Guest
Oh duh I freaking forgot to put the controller in the room son of a hell I'm literally the stupidest person ever XD
Some people wonder why support teams ask stupid questions like 'Is your device plugged and turned on?'.
Now you know why :D
 
Top