Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 629 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pulling skills and flags into event function possible? #222076
08/17/08 21:23
08/17/08 21:23
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
I have a "interesting" issue, I've written the following code:
Quote:
#define health skill1
... //and so on
#define invincible FLAG1 //EDIT: Updated to what is shown in code

...

action makeGuard();

function modelHit()
{
if (event_type == EVENT_IMPACT)
{
if (my.invincible == ON) //Looks like flags and such don't transpher over, move back to global struct?
{
...
}
}

...

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
...
my.emask |= ENABLE_IMPACT;
my.event = modelHit;
...
}
...


But I get an error saying that "flag1 is not a member of ENTITY" since I know you can call certain values like my.pan into the event function and it work just fine, can you not pull skill's and flags into it as well? If this is so I can just transfer everything into a struct and it will work that way, I simply wanted to know if I could use skills and flags of an ENTITY to make it a bit easier.

Any clarification would be nice. Thanks guys smile

Last edited by Trooper119; 08/18/08 01:18.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: pulling skills and flags into event function possible? [Re: Trooper119] #222083
08/17/08 21:55
08/17/08 21:55
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
needs to be FLAG1 now ... we love you conitec! =D

Re: pulling skills and flags into event function possible? [Re: MrGuest] #222100
08/18/08 00:20
08/18/08 00:20
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
Brilliant, now that I know what to look for it's rather simple. Seems weird they kept skill1 and so on lowercase though. Appreciate the help, as always.

In the debuggers infinite wisdom though it keeps giving me "Syntax Error" once I corrected the "flag1" issue, for example in action makeGuard(); I have the following code that all gives a syntax error (gives it in many places, but this is a bit simpler to analyze).

Quote:
//define skills and flags
#define health skill1
#define velX skill2
#define velY skill3
#define velZ skill4
#define state skill5
#define damage skill6
#define invincible FLAG1
#define onGround FLAG2

//define player states
#define inactive -1
#define idle 0
...

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
my.health = 0;
my.state = idle;
my.invincible = OFF;
...
}

EDIT: Only the flag's show an error now

It's as if the skills and flags aren't defined correctly or the my is pointing somewhere funky. I simply don't know what's wrong, sorry for the vague request but please feel free to ask for more code if you'd like, I simply didn't want to dump a large block of it and walk away saying "duhhh, please help :/"

Sorry for the lame request but I've been looking through the manual for a while now with no success.

Last edited by Trooper119; 08/18/08 01:20.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: pulling skills and flags into event function possible? [Re: Trooper119] #222103
08/18/08 00:38
08/18/08 00:38
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
yeah lose the ; after defines aswell =D bow before the might of Conitec! :P

Code:
#define health skill1


Re: pulling skills and flags into event function possible? [Re: MrGuest] #222105
08/18/08 01:17
08/18/08 01:17
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
I really do appreciate your help. Unfortunately removing the semicolon didn't remove the error, I updated the code I referenced with the new code.

EDIT: Change that, only the flags don't work now, trying to fix now, let me know if you know anything

EDITx2: Alright, found the error, looks like my.invincible = OFF; doesn't work for some reason, changing everything so it uses the flag functions like is(), set() and reset(), these seem to work

Last edited by Trooper119; 08/18/08 01:23.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: pulling skills and flags into event function possible? [Re: Trooper119] #222110
08/18/08 02:11
08/18/08 02:11
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
can you put your code up, how are you referencing the flags?

Re: pulling skills and flags into event function possible? [Re: MrGuest] #222222
08/18/08 15:10
08/18/08 15:10
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
I apologize, everything works, and I didn't think anyone would really want anything as a reference for future problems, my code now works, I'm working on a run-time issue now that is completely unrelated, so sorry for the delay but here is what I did:

Quote:
//define skills and flags
#define health skill1
#define velX skill2
#define velY skill3
#define velZ skill4
#define state skill5
#define damage skill6
#define invincible FLAG1
#define onGround FLAG2

...

function modelHit()
{
if (event_type == EVENT_IMPACT)
{
if(is(my,invincible)) //changed from my.invincible == ON
{ ... }
if(is(my,onGround)) //Changed from my.onGround == ON
{ ... }
}
...
}

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
...
reset(my,invincible); //changed from my.invincible = OFF;
...
}


Last edited by Trooper119; 08/18/08 15:13.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C
Re: pulling skills and flags into event function possible? [Re: Trooper119] #222228
08/18/08 15:35
08/18/08 15:35
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
ok i've just done a quick test and it's working the way it should...

looking at that part your code you haven't set the flag to on anywhere
Code:
	set(me,invincible); //turns on
	reset(me,invincible); //turns off


Re: pulling skills and flags into event function possible? [Re: MrGuest] #222232
08/18/08 16:03
08/18/08 16:03
Joined: Apr 2004
Posts: 516
USA
Trooper119 Offline OP
User
Trooper119  Offline OP
User

Joined: Apr 2004
Posts: 516
USA
Yea I realize that, I appreciate the help, but my invincible/guard state isn't implemented yet, (shhh, don't tell anyone.) Thanks for all the help, I'm mainly trying to get my characters to react to each other and the environment, I simply but a invincible flag up to detect for my guard state, however much like the rest of my code, it's unfinished.

Last edited by Trooper119; 08/18/08 16:04.

A clever person solves a problem.
A wise person avoids it.
--Einstein

Currently Codeing: Free Lite-C

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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