el3um4s's Recent Forum Activity

  • In documention I find this:

     if (self.c2_callFunction) self.c2_callFunction("name", ["param1", "param2"]);
    

    So I create my own function:

     CallFunction(nameFunction = "", param = []) {
     if (self.c3_callFunction && nameFunction != "") {
     if (param.length === 0) {self.c3_callFunction(nameFunction);}
     else {self.c3_callFunction(nameFunction, param);}
     }
     }
    

    When I test it in Preview it's all ok. Also when I export the project without script minification.

    But if I want to unbly "minify script" in the export I have to use:

     CallFunction(nameFunction = "", param = []) {
     if (self["c3_callFunction"] && nameFunction != "") {
     if (param.length === 0) {self["c3_callFunction"](nameFunction);}
     else {self["c3_callFunction"](nameFunction, param);}
     }
     }
    

    My question is: what is the correct way between self.c3_callFunction("name", ["param1", "param2"]) and self["c3_callFunction"]("name", ["param1", "param2"])?

    I do not know if it's a bug or a lack in the documentation. I know for external api I must to use string syntax but I did not think it was for official API.

  • Thank you for your answer.

    I can create an optional property (Model) where you can insert the variable's name. I didn't think about injection attacks. Maybe I can put a function to sanitize external input.

  • JavaScript (Learning Web Tchnologies).

    If you like, the FreeCodeCamp is a good place to start.

  • Ashley

    In the manual I can find how to get an instance variable value by its index (GetInstanceVariableValue(index)). But I can not find references on how to get the value of a variable starting from the name.

    I can do it with some undocumented features:

    GetInstanceVariableIndexFromName(string) {
    	//return this.GetInstance()._GetAllInstanceVariableNames().indexOf(string);
    	return this.GetInstance()._instVarNames.indexOf(string);
    },
    GetInstanceVariableValueFromName(string){
    	const pos = this.GetInstanceVariableIndexFromName(string)
    	return pos < 0 || pos > this.GetInstance().GetInstanceVariableCount() ? '' : this.GetInstance().GetInstanceVariableValue(pos );
    }
    

    What is the correct way to do this using the documented features?

    I need it because I'm experimenting with one of my plugins. My idea is to be able to directly access the variables via '{{ variable }}'.

    I can get the same result by writing {{0}} {{1}}. But it's much clearer and simpler if I can write {{name}} {{surname}}.

  • Like this?

  • mumu64 Thank you

    I'm working on my new plugin. There is still a lot of work to do. But I am already quite satisfied.

  • Something like this? https://el3um4s.github.io/construct-inject-css-plugin/demo/inception/

    (Inception.c3p)

    Subscribe to Construct videos now

    However, this plugin is not explicitly designed to insert html elements. I'm working on a specific plugin, with some extra features.

  • This is a demo for youtube: YouTube.c3p

    Online: InjectCSS - Youtube

  • You can use this plugin: Inject CSS

    This is a simple demo: iframe.c3p

    This is a demo in the browser (you have to allow scripts to execute external scripts into iframe).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Short Description

    Use CSS stylesheet in Construct 3 and inject simple html elements.

    Link

    How to insert local CSS file

    How to insert remote CSS

    Properties

    Conditions

    Actions

    Tagged:

  • Strani Anelli - Motivational Quotes

    Get and create motivational quotes. Shows a motivation quote when you launch Construct 3. Provide a random motivational quote in your personal project.

    Links

    DESCRIPTION

    This plugin has two parts:

    1. the first shows a motivation quote when you launch Construct 3.
    2. the second provide a random motivational quote in your personal project

    It's possible to set 3 sources for the random quotes:

    1. the plugin's library
    2. a project file in your own project
    3. a json file from another site

    In the example file I show how to use all the 3 methods. The external source is set on FreeCodeCamp repository but you can customize it.

    DEMO GIF

    HOW TO USE

    -> System: Set newQuote to MotivationalQuotes.GetQuoteJSON (as JSON)

    -> quote: Set text to MotivationalQuotes.GetQuoteFromJSON(newQuote)

    -> author: Set text to MotivationalQuotes.GetAuthorFromJSON(newQuote)

  • Tonight after a couple of week finally I worked on my one touch platformer game. I decided to improve my level editor.

    I hope to add the preview options in the next days.

    Subscribe to Construct videos now
el3um4s's avatar

el3um4s

Early Adopter

Member since 9 Nov, 2015

Twitter
el3um4s has 16 followers

Connect with el3um4s

Trophy Case

  • 9-Year Club
  • Forum Contributor Made 100 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies