How do I create a Global Function ?

Get help using Construct 2

Post » Wed Aug 05, 2015 10:22 am

I create a function in an event Sheet and on the next layout, I want to call that function again.
The Function Intellisense dropdown list list the function, so I select it, but I soon realize it is not being called at all.

Why list the function there if it is not available in the event sheet and only available in the event sheet it was declared in ?

Can I make a function global ?
B
12
S
3
Posts: 288
Reputation: 1,694

Post » Wed Aug 05, 2015 10:48 am

Create a Main event sheet.
Now include an eventsheet called variables (make it and put all your variables there)
Now include a eventsheet called functions (make it and put all your functions in there)
Now include a eventsheet called changelog (make it and put all you changes via comments in there) etc etc.

you can make groups that have eventsheets included.

The purpose is to have a main eventsheet that pulls in code from everywhere else.

One new eventsheets you can then include main eventsheet or something like that.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Wed Aug 05, 2015 3:54 pm

Ok, I have done that, now, how do I attach more than one event sheet with a layout ?
One specific to the layout and one containing all the global functions for the layout to use ?
B
12
S
3
Posts: 288
Reputation: 1,694

Post » Wed Aug 05, 2015 4:18 pm

Toddler wrote: how do I attach more than one event sheet with a layout ?


You might include an event sheet into another. Check the "Include event sheet" option.
B
15
S
5
Posts: 40
Reputation: 1,221

Post » Wed Aug 05, 2015 4:46 pm

Right click the event sheet and choose "Include event Sheet"
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Thu Aug 06, 2015 1:30 pm

Include Event Sheet is the best invention since Static function in the coding world !
THANK YOU !
B
12
S
3
Posts: 288
Reputation: 1,694

Post » Thu Aug 06, 2015 3:43 pm

Library imports have been around almost since the beginning of computer science, lol.

Wikipedia

The earliest programming concepts analogous to libraries were intended to separate data definitions from the program implementation. JOVIAL brought the "COMPOOL" (Communication Pool) concept to popular attention in 1959, although it adopted the idea from the large-system SAGE software. Following the computer science principles of separation of concerns and information hiding, "Comm Pool's purpose was to permit the sharing of System Data among many programs by providing a centralized data description."


I wasn't alive then though. :-p
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830


Return to How do I....?

Who is online

Users browsing this forum: Artcadev and 47 guests