prompt / alert plugin

0 favourites
  • 10 posts
From the Asset Store
Toggles Dials Switches and Alerts ! A foundational sound grouping of Analog type switches and Steampunk effects
  • I'm juste learning very basic plugin writing.

    I try to make an alert with the text that be inputed in the addstringparam.

    So here is my action in the edittime.js

    // Actions

    AddStringParam("Set the text", "The text to set in the alert box.");

    AddAction (0, 0, "Set text to display", "General", "Display: {0}", "Display text in an alert box", "SetText")

    and here is my action in the runtime.js

    // Actions

         pluginProto.acts = {};

         var acts = pluginProto.acts;

         

         acts.SetText = function (text)

         {

              alert(text);

         };

    I don't really know javascript but have some basics. This way doesn't display anything.

    Can you help me to solve that basic problem.

    Thx

  • I don't know if it is just for learning or if you need it, but alert is already implemented in the browser object.

    So if you need it, insert a browser object to your project. And if it is for learning, you can check the sources in c2\exporters\HTML5\plugins\browser.

    EDIT: : Also be sure to check the SDK it links to good JS ressources.

  • Both :)

    I'm gonna take a look to that right now. Thanks

  • I'm trying to do the same thing with "prompt" command.

    I would know (because I didn't find the answer, in the SDK or on the web)

    how to recup a value (string or numbers) from the prompt ? I would like to use it as expression, as get text of the text object.

    In the same time, is it possible to know if a button of the prompt command is clicked ?

    Thanks a lot for your help

  • Have you checked Mozilla's Javascript Guide - https://developer.mozilla.org/en/JavaScript/Guide and Mozilla's Javascript Reference - https://developer.mozilla.org/en/JavaScript/Reference ?

    C2 forum can help on specific points/questions but learning javascript is something well-documented enough and you have to learn it on your own first.

    EDIT: also Prompt seems to be linked to DOM, and ash advice not to mess with it in the SDK. I'm not sure there nevertheless.

    But if you're starting with C2, you really shouldn't take the plugin route at first. Read the tutorials about C2 first and explore its "officials" plugins and the plugins provided by the community too.

  • Yes I'm totally agree. But I'm curious, and I've worked for many years on Multimedia Fusion (and I still do) from clickteam, so I understand all basics of construct (which are not so different).

    As I already explained, I don't do games but personal/professional apps, and unfortunately, C2 hasn't got already enough of plugins for that kind of using. That's why I try to add just some really simple features (as an input dialog)

    That's my way of discovering ;) I can understand quickly javascript, as C2, but I'm not sure to well understand the way that plugin scripting and original javascript language are linked... You know what I mean ?

    Merci ? toi ;)

  • Plugin scripting is built on top of javascript.

    JS is the language to use, with its rules, syntax, standard functions, etc...

    Plugins (the SDK) are written in javascript and in such a way that it's interfaced with C2's events system.

    This article from Scirra's blog might be a good read too. It clearly identifies each parts of C2 and their interactions/implications.

    I can understand the feel to need more than there is actually, but I'm pretty sure text box, button, text, array, ajax, browser and webstorage objects + events system can already let you make nice functionning apps.

    What more do you need ?

  • Thanks you Kyatric, I'll read it and take a closer look to JS.

  • try to use this plugin

    or see it as example...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Finally, I figured out. I already did three options for my plugins, and it works. Thanks you all.

    I may share it when it'll be finished.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)