Page 1 of 1

[ASK] What Functions do you use most?

PostPosted: Mon Jan 26, 2015 7:44 pm
by Bee-Ant
The title says it all.

I'm wondering what event and functions do people use most in GE. Please list them all.



EDIT:
Event in this case are:
- Collision
- Create Actor
- Draw Actor
- Keydown
- etc

Function in this case are:
- Physical Response
- MoveActor
- Create Actor
- Play Sound
- etc

Re: [ASK] What Functions do you use most?

PostPosted: Mon Jan 26, 2015 7:54 pm
by schnellboot
definately Draw Actor and Script Editor haha

Re: [ASK] What Functions do you use most?

PostPosted: Mon Jan 26, 2015 8:03 pm
by lcl
Here's my list :)

Events:
  • Activation Event (through code, not the colored lines created via right-clicking)
  • Collision
  • Create Actor
  • Draw Actor
  • Key Down
  • Key Up
  • Mouse Button Up
  • Mouse Button Down

Actions (as in the list that pops up after selecting an event):
  • Script Editor (I don't use any other ones, all those can be done in script editor with more flexibility, so why bother?)

Functions (as in built-in script editor functions in GE):
  • ActorCount
  • ChangeAnimation
  • ChangeAnimationDirection
  • CreateActor
  • DestroyActor
  • EventDisable
  • EventEnable
  • ExitGame
  • GetKeyState
  • SendActivationEvent
  • VisibilityState
  • And of course all the basic C functions like math functions, file i/o, drawing functions, etc. I'm too lazy to name all those :P

EDIT: How about you, Bee-Ant?

Re: [ASK] What Functions do you use most?

PostPosted: Mon Jan 26, 2015 8:34 pm
by Jagmaster
I haven't used GE in a long time. I doubt these are supported in c, but I'm getting pretty addicted to lists in c#, they're pretty handy for things like databases and inventory systems.

As for GE functions, I can't count the amount of times I had to put a physical response function on my actors. That was one of the reasons I was looking forward to box2d integration many moons ago.

Other than that, my list would be pretty much identical to Bee-Ant's, schnellboot's and lcl's.

I think there was one other custom function, like getActor2 or something like that that I used a lot.

also fprintf, since that was the only decent way to edit a string lol.

Re: [ASK] What Functions do you use most?

PostPosted: Tue Jan 27, 2015 6:18 am
by Bee-Ant
Thanks for the list everyone :D

schnellboot wrote:definately Draw Actor and Script Editor haha

Can't live without it too :P

Jagmaster wrote:but I'm getting pretty addicted to lists in c#, they're pretty handy for things like databases and inventory systems

Javascript has that too. It's quite fun to play with indeed.

lcl wrote:How about you, Bee-Ant?

I used to use the following Event(s):
- Animation Finish
- Collision
- Collision Finish
- Create Actor
- Draw Actor
- Key Down
- Key Up
- Timer

The following Action(s):
- Script Editor

The following Function(s):
- Change Animation
- Change ZDepth
- Create Actor
- Create Timer
- Destroy Actor
- Destroy Timer
- Exit Game
- Load Game
- Physical Response
- Play Music
- Play Sound
- Visibility State
- fread
- fwrite
- getclone
- max
- min
- rand
- strcat
- strcmp
- strcpy
- strlen

The followings Variable(s):
- x
- y
- xvelocity
- yvelocity
- angle
- directional_velocity
- r
- g
- g
- transp
- animpos
- animindex
- width
- height
- cloneindex
- musicvol
:mrgreen:

Re: [ASK] What Functions do you use most?

PostPosted: Tue Jan 27, 2015 8:40 am
by MrJolteon
if

Re: [ASK] What Functions do you use most?

PostPosted: Thu Jan 29, 2015 3:59 pm
by tvz
MrJolteon wrote:if
same for me

Events:
- Animation Finish
- Collision
- Create Actor
- Draw Actor
- Key Down
- Key Up
- Timer

Functions:
- Change Animation
- Create Actor
- Create Timer
- Destroy Actor
- Destroy Timer
- Exit Game
- Load Game
- Physical Response
- Play Music
- Play Sound
- Visibility State
- getclone

Variables:
- r
- g
- b
- x
- y
- xvelocity
- yvelocity
- angle
- directional_velocity
- height
- width
- cloneindex
- musicvol
- animpos
- transp

and my favourite line of code is

Code: Select all
animpos=cloneindex; //XD

Re: [ASK] What Functions do you use most?

PostPosted: Thu Jan 29, 2015 6:57 pm
by Bee-Ant
MrJolteon wrote:if

I think it's a conditional check instead of function?

@tvz: Ha... use that code too. Usually for menu button ;)

Re: [ASK] What Functions do you use most?

PostPosted: Thu Jan 29, 2015 7:33 pm
by lcl
Bee-Ant wrote:
MrJolteon wrote:if

I think it's a conditional check instead of function?

Yes, Bee-Ant is right, if is not a function. In C, if is a keyword for conditional statement.

Re: [ASK] What Functions do you use most?

PostPosted: Wed Jun 03, 2015 1:13 am
by Zivouhr
Nice lists of functions. I use a lot of those also. My favorite is the script editor since it lets you copy/paste codes.

Question I've had is about the key down functions.

While there's an automated way to click on actor/keydown event (select the keys)/script editor or event applied, is there a way to manually create a key down event within a script itself?
For example, I'm guessing you can't add a key down event in let's say, a create actor script editor to create manual code for a keydown:

In other words, is there ever a way to script the drop down choices for a key down event within a script editor of create actor?
KEY DOWN:
"Press the key or key sequence" Keys: Right, right, right, left
Execute when: Keys are pressed in order
Repeat: Enable
Script Editor

It's a weird question but sometimes I'm in a script editor window, and wish I could figure out how to access the key down options, but have never seen an example of it in a script, so imagine it might not be possible, since Makslane programmed the Key Down Function as a drop down choice in Add/Events.
Just like we probably can't script a "Draw Actor" separately outside of the add/draw actor event.
I don't recall what I was going to use this for other than more control options, so it's not a big deal. I just need to learn more about C and its logic for more complex commands.

Re: [ASK] What Functions do you use most?

PostPosted: Wed Jun 03, 2015 6:19 am
by koala
I was wondering the same thing. Good question.

Re: [ASK] What Functions do you use most?

PostPosted: Thu Jun 04, 2015 12:51 am
by Zivouhr
Thanks Koala. I remember I wanted to apply those features in a player/drawactor/script editor event, especially the repeat enabled or disabled option most of all.

Re: [ASK] What Functions do you use most?

PostPosted: Thu Aug 06, 2015 11:39 pm
by bat78
Short answer - it's possible.
Is it hard - no

You can use the function getLastKey that returns the corresponding decimal number (known as key code) of the last pressed key.
Game-Editor defines several macros in order to provide textual representation of these key codes.
KEY_a
KEY_LEFT

etc
There is another function that converts key code into a context string. To assure yourself, you can use something like that:
Code: Select all
sprintf(text, "Last pressed key: [%s]", getKeyText(getLastKey()));

And the last but not the least, a function to return the condition of all the keys. It returns a statically allocated array with the condition of each key (whether it is pressed or not).
Code: Select all
char *key = GetKeyState();

if(key[KEY_a]) {...}
//or if(key['a']) {...}


Now you can use these functions to compose functions such as:
Code: Select all
int keyDown (int keyCode, int repeat); // Returns 1 if the key specified by keyCode is pressed, set repeat to 1 if you want it to return 1 if it is held.
int keyList (int keyCodes [], int repeat); // Returns 1 if at least one of the keys specified by keyCode is pressed, set repeat to 1 if you want it to return 1 if it is held
int keySequence (int sequence []); // Returns 1 if all the keys specified by sequence are pressed

Re: [ASK] What Functions do you use most?

PostPosted: Thu Oct 08, 2015 8:44 pm
by Zivouhr
Thanks for the information Bat. I'll take a look into it.