1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

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:
    653
    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