Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/21/26 19:15
Camera always moves upwards?
by clonman. 02/21/26 09:29
Zorro version 3.0 prerelease!
by TipmyPip. 02/20/26 13:22
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 6,962 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
event_type #300961
12/07/09 10:17
12/07/09 10:17
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Normally I check event_type inside an event function and depending on the content I perform some stuff.

Now let's say the only thing I do inside the event function is sth. like: my->skill42 = event_type;


If I then check the content of skill42 outside the event function in a cyclic runnign entity function...

... what exactly is store?
1) The last event
2) all events since last wait() as a bitmask
3) a different way

Why am I asking this?
I want to know if I can catch several events which might have happened or if I can only catch the last event. Speaking of the fact, that I do NOT perform the check inside the event function.

Yes, I can of course build up my own bit mask inside the event and then check this one... just wanted to know if this is necessary or if this feature is already there laugh

Re: event_type [Re: FBL] #300976
12/07/09 13:18
12/07/09 13:18
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Its only the "most recent" event triggerd for that entity.

BUT, you could do this.
In the event
my->skill42 |= event_type; //collect a bitmask of all events for this entity
Then in the function that uses this info, set my->skill42 = 0; once checks are done.


Last edited by EvilSOB; 12/07/09 20:48.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: event_type [Re: EvilSOB] #300979
12/07/09 13:26
12/07/09 13:26
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Hmm... I'm not sure that'll work. Bitmasks are only necessary for flags that can be used in combination with each other, while event_type is never more than one type of event, so it's probably not set up that way (although it could be, for some internal reason).

So unless you've tested it, and found for some reason it works, that won't do it.

I'd also say that since in an event function one tests for equality, event_type stores that event and only that event.

I hope that's useful,

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: event_type [Re: JibbSmart] #301019
12/07/09 19:42
12/07/09 19:42
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Originally Posted By: JulzMighty


I'd also say that since in an event function one tests for equality, event_type stores that event and only that event.



Yes that's a valid point I could have thought of earlier. duh. Thanks for pointing out.

so the question left is whether the EVENT types are organized in a way to support bit masking.

Re: event_type [Re: FBL] #301021
12/07/09 20:09
12/07/09 20:09
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
what's the purpose of this?
bitwise operators doesn't work.
you can store the eventtype into a skill in a event function
test code every idea that doesn't work is comment out.
Click to reveal..

Code:
//#define skill4 event_type
function event_func()
{
//	me.skill4 =| (event_type);
	me.skill4 = event_type;
}

action test_ent()
{
	my.emask = (ENABLE_SCAN|ENABLE_DETECT);
	my.event = event_func;
	while(1)
	{
		c_scan(me.x,me.pan,vector(360,0,200),IGNORE_ME);
		if(me.skill4 == EVENT_DETECT)beep();
		
		wait(1);
		
	}
}
function main()
{
	level_load("");
	ent_create("",nullvector,test_ent);
	ent_create("",vector(10,0,0),NULL);
}




Bit mask:
perhaps event_type are bit mask but i guess the skills aren't bit masks(how you can creat bit masks on your own?)

muffel

Re: event_type [Re: muffel] #301022
12/07/09 20:25
12/07/09 20:25
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
I have tested a little bit more
testcode:
Click to reveal..
Code:
ENTITY* ent;
var test;
var test2;
function event_func()
{
//	me.skill4 =| (event_type);
	me.skill4 = event_type;
}

action test_ent()
{
	my.emask = (ENABLE_SCAN|ENABLE_DETECT);
	my.event = event_func;
	while(1)
	{
		c_scan(me.x,me.pan,vector(360,0,200),IGNORE_ME);
		if(me.skill4 == EVENT_DETECT)beep();
		test = me.skill4;
		wait(1);
		
	}
}
action test_ent2()
{
	my.emask = (ENABLE_SCAN|ENABLE_DETECT);
	my.event = event_func;
	while(1)
	{

		if(me.skill4 == EVENT_SCAN)beep();
		test2 = me.skill4;
		wait(1);
		
	}
}
function main()
{
	level_load("");
	ent = ent_create("",nullvector,test_ent);
	ent_create("",vector(10,0,0),test_ent2);
}


test was always 7 test2 alwalys 8
So i think EVENT_SCAN and every over event are only enums
hope this tip could help

muffel

Re: event_type [Re: muffel] #301024
12/07/09 20:47
12/07/09 20:47
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Doh, muffel is right... event_types are only an enum, not a bit-mask (as I assumed).
My coding idea for the event is stuffed...

Muffel, to see how to create your own bitmasks, take a LOOK at
"atypes.h" in the gamestudio "include" folder. (just dont change it)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: event_type [Re: EvilSOB] #301036
12/07/09 22:10
12/07/09 22:10
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Well thanks for trying that out, muffle wink

Ok, then it's creating a manual bitmask... 1<<event_type tongue

Might work as long as the values vor event_type do not become too high....

oh. This brings me to the idea I could have just looked into the includes.

DOH! Not my day today.

Code:
//event definitions
#define EVENT_BLOCK		1	// collision with level block
#define EVENT_ENTITY	2	// collisions with entity
#define EVENT_STUCK		3	// stuck in a corner
#define EVENT_PUSH		4	
#define EVENT_IMPACT	5	// hit by another entity
#define EVENT_FRICTION	6
#define EVENT_DETECT	7
#define EVENT_SCAN		8
#define EVENT_SHOOT		9
#define EVENT_TRIGGER	10
#define EVENT_SONAR		11
#define EVENT_FRAME		12

#define EVENT_RECEIVE	13	// Entity received skills
#define EVENT_DISCONNECT 20	// Entity client has disconnected

#define EVENT_CLICKUP	14	// left click over down toggle
#define EVENT_BUTTONUP	15	// mouse button released over entity
#define EVENT_TOUCH		16	// mouse pointer moves over entity
#define EVENT_RELEASE	17	// mouse pointer leaves entity
#define EVENT_CLICK		18	// left click over entity
#define EVENT_RIGHTCLICK 19	// right click over entity

#define EVENT_JOIN		32	// client joined
#define EVENT_LEAVE		33	// client left
#define EVENT_STRING	34	// received a string
#define EVENT_DATA		36	// received a data buffer (7.04+)
#define EVENT_VAR		37	// received a variable




I think this can be closed.

Re: event_type [Re: FBL] #301090
12/08/09 10:51
12/08/09 10:51
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
We'll provide a standard event function that just resets the corresponding event flag. This way you can check for a triggered event in the main function.


Moderated by  old_bill, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1