e0x's Forum Posts

  • 3 posts
  • Ok it works now.

    I just have to modify the script, adding "First" :

    var textObject = runtime.objects.H1.getFirstPickedInstances();
    var content = textObject.text;
    navigator.clipboard.writeText(content)

    Thanks you again WackyToaster <3

  • Thank you very much for your response WackyToaster.

    So I tried your solution:

    var textObject = runtime.objects.H1.getPickedInstances();
    var content = textObject.text;
    navigator.clipboard.writeText(content)

    And I no longer have any error messages in the console. However, where it should copy my text to the clipboard, all it returns is:

    undefined

    I can't seem to get any other results...

    Did I make a syntax error?"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello everyone :)

    So I have this piece of script that works well:

    var textObject = runtime.objects.H1.getFirstInstance();
    var content = textObject.text;
    navigator.clipboard.writeText(content)

    It allows me to copy the text content of the H1 object into the clipboard.

    But now the problem is when I try to target an instance of this object, by its UID stored in a variable "uidH1", with this script:

    var myVariable = runtime.globalVars.uidH1;
    var textObject = runtime.objects.H1.getInstanceByUid(myVariable);
    var content = textObject.text;
    navigator.clipboard.writeText(content)

    I get this error in my console:

    TypeError: runtime.objects.H1.getInstanceByUid is not a function

    I'm not very familiar with JavaScript, and I don't know where else to look. If anyone can help me, it would save me.

  • 3 posts