Extending Construct 2 with Javascript

Discussion and feedback on Construct 2

Post » Wed Feb 09, 2011 6:44 am

Alright guys. I put all I currently know into this puppy. It's a trimmed down keyboard object with a few example ACE entries in it and a lot of comments. It is likely very buggy, but it should familiarize you with everything. You can use it as a starting point if you like, but realize that I'm just feeling my way around blindly. Now that I'm fairly familiar with everything, I'm going to try and implement simplex noise as a plugin.

The two parts you want to really familiarize yourself with mainly are the ACE definition macros in the edittime file and how those relate to the ACE definitions in the runtime file. That should get you well on your way.

[url:32r5jhcr]http://dl.dropbox.com/u/1032313/SDKTut.zip[/url:32r5jhcr]
B
5
S
2
G
5
Posts: 221
Reputation: 2,272

Post » Wed Feb 09, 2011 7:39 am

thanks, that helped a lot. :)

PS
a tip for everybody, don't use notepad it'll just confuse you more, use notepad++
B
9
S
3
G
3
Posts: 366
Reputation: 2,301

Post » Wed Feb 09, 2011 11:45 am

Notepad++ is better then classic Notepad, but I must recommend the PSPad because this software is better than anyone else source editor for me.

PSPad is a freeware programmer's editor for Microsoft Windows operating systems, useful for people who:

[list:1izjc43w] [*:1izjc43w] work with various programming environments
[/*:m:1izjc43w][*:1izjc43w] like highlighted syntax in their source code
[/*:m:1izjc43w][*:1izjc43w] need a small tool with simple controls and the capabilities of a mighty code editor
[/*:m:1izjc43w][*:1izjc43w] are looking for a tool that handles plain text
[/*:m:1izjc43w][*:1izjc43w] want to save time - PSPad offers rich text formating functions
[/*:m:1izjc43w][*:1izjc43w] need tool what offer user extension capabilities
[/*:m:1izjc43w][*:1izjc43w] want to save money and still have the functionality of professional products because PSPad is free for commercial and government purposes too[/*:m:1izjc43w][/list:u:1izjc43w]

List of changes, history and bug corrections is available here

If you have a problem or question, you can visit the PSPad discussion forum. After registration you can receive messages for chosen topics via e-mail.

PSPad beta versions are published in the discussion forum. You can download them without any restrictions, test new program functions and have bugs corrected before the full release is available.

The latest build published in the forum is 4.5.5 (2405)

PSPad is available in eight languages:
Cesky | Slovensky | English | Deutsch | Franais | Italiano | Russian | Espaol
B
1
G
2
Posts: 6
Reputation: 637

Post » Wed Feb 09, 2011 12:21 pm

I like Visual Studio because of intellisense with JS, is there any free editor out there like notepad++ but for JS with intellisense style features?
Image Image
Scirra Founder
B
125
S
37
G
25
Posts: 3,945
Reputation: 44,922

Post » Wed Feb 09, 2011 3:04 pm

@Arsonide: good tutorial but the expressions are wrong: the return value from expressions is ignored. You need to write PieExp like this:

[code:2zaldcb6]exps["PieExp"] = function(ret) // all expressions take a 'ret' parameter
{
// Call set_string, set_int or set_float on the ret object to return a value
// The value returned from this function is ignored!
// If your expression has parameters, they follow on after 'ret', e.g.:
// function(ret, x, y)
ret.set_string("Pie");
};[/code:2zaldcb6]
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Feb 09, 2011 10:58 pm

Any suggestions for basics, stuff for complete noobs to javascript?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Feb 09, 2011 11:19 pm

A good way to learn JS is by just giving it a go, and posting anything you get stuck on at stackoverflow.com
Image Image
Scirra Founder
B
125
S
37
G
25
Posts: 3,945
Reputation: 44,922

Post » Thu Feb 10, 2011 1:12 am

[quote="Ashley":aociby2w]@Arsonide: good tutorial but the expressions are wrong: the return value from expressions is ignored. You need to write PieExp like this:[/quote:aociby2w]

Hehe, can you tell I got confused there? :P I thought I'd read something about expressions being broken, and I noticed the format changed - at least in the text object, between AC and E, and I couldn't figure out from the text object's expression how it was tied with it's "function".

In a moment I will update the file with your section so there's not more confusion.
B
5
S
2
G
5
Posts: 221
Reputation: 2,272

Post » Thu Feb 10, 2011 1:29 am

Another small thing is I noticed a lot of semicolons missing - Javascript does automatically insert missing semicolons, but it's considered bad practice to miss them out - all your statements especially the 'acts["..."] = function () { ... };' should have that trailing semicolon too.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Feb 10, 2011 3:32 am

[quote="newt":1nsczkp8]Any suggestions for basics, stuff for complete noobs to javascript?[/quote:1nsczkp8]

try [url:1nsczkp8]http://www.w3schools.com/[/url:1nsczkp8]
i'm learning from their tutorials
B
9
S
3
G
3
Posts: 366
Reputation: 2,301

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: erandi1984 and 14 guests