e0x's Recent Forum Activity

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

e0x's avatar

e0x

Member since 25 Mar, 2019

None one is following e0x yet!

Trophy Case

  • 5-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

8/44
How to earn trophies