1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

String in script arguments?

Discussion in 'Programming' started by DIF Studios, Jan 13, 2018.

  1. DIF Studios

    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 :)
     
  2. Binsk

    Binsk Member

    Joined:
    Jun 22, 2016
    Posts:
    620
    There is no instance of textbox_obj in existence when you are calling the script. That is the issue.
     
  3. DIF Studios

    DIF Studios 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
     
    CedSharp likes this.
  4. CedSharp

    CedSharp Member

    Joined:
    Sep 5, 2016
    Posts:
    665
    Some people wonder why support teams ask stupid questions like 'Is your device plugged and turned on?'.
    Now you know why :D
     
  5. DIF Studios

    DIF Studios Guest

    Lol I know I feel so freaking dumb right now
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice