Code support

Discussion and feedback on Construct 2

Post » Thu Feb 05, 2015 7:09 am

There are still some benefits for pure text code. For example , string (text) could be transfered from network or loaded from external file.

Official browser object already has "Execute Javascript" action , to run code from string, and official function object could be ran by text like
Code: Select all
c2_callFunction("name", ["param1", "param2"]);


I also had made some plugins which could
- run official function from CSV string, or
- create a JSON string to save the function call, or
- run lua script.

These are not to replace the event sheet, just embed text code which only has pure logic inside, to be a part of event system.
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Thu Feb 05, 2015 12:17 pm

codah wrote:-1 for me. There will be biases depending on the language(s) you've come from and nobody will agree on any of it. For instance I already don't like the format you have described. Where's my curly braces? :lol:
...
Lastly, you have some typo's (which is a lot harder to do in the current system).

Python-like syntax was taken as example because it's quite clear. I personally don't care that much, as I'm writing on JavaScript, C#, PowerShell and Python a lot.
I'm also like curly braces :)
As for typos — you can make typo in expression text box now. System, which checks your expressions already implemented in C2.

rexrainbow wrote:@anpur
You had missed something in this too simple example-
1. how to get the object reference (i.e. object name + SOL)? It might be more then 10 or 100 object types in the project.
2. how to get the function name (i.e. action name) or member name (i.e. expression)? Each kind of object type might has a lot of members (functions). And the input parameters of these functions...

First of all, this is C2 whom hides difference between classes and instances from user entirely. Which makes it a bit vague in some cases and fully context dependent.
In code, from other side, it can be made really emphasized and clean.
About function names — you have exactly same situation, when you're constructing expression anywhere in C2. This is why you have a nice, semi transparent window near every expression text box, here is its example from one of tutorials:
objectpanel.png


-----

Again, I'm not proposing to remove or even affect event system or graphical event editor.
I'm just saying, that:
1. Almost all features required, like syntax highlight, object members explorer window, syntax and members verification already implemented and working in C2.
2. Code block can be used side by side near other events
3. Text has more expression power and also easier to manage.
So, we only need to think through some decent UI and some additional keywords, like loops, conditional expressions and block organization.

P.S. — this all is just thinking out loud, as Ashley said that there are no plans to add something like this to C3.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 15
Reputation: 457

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: moebios and 8 guests