Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 405 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Skills Question #470435
01/14/18 17:11
01/14/18 17:11
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I am wondering if there is any way to sort through an entity's skills without writing a separate line for each skill. Here is what I have in mind, but I'm certain this will not work in this format. Is there a way to write a script like this?

Quote:

while(my.skill# < 100)
{

//check the number stored in this skill and do something with it

my.skill# += 1;
wait(1);
}


I guess I'm wondering if skills can be used as an array?

Re: Skills Question [Re: Dooley] #470437
01/14/18 18:29
01/14/18 18:29
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
It's possible, at least when you're using lite-C. Have a look at GStudio8/include/atypes.h:

Code:
typedef struct ENTITY {
	C_LINK link;
	char	*type;		// entity file name
	...
	var	skill[100];	// entity skills
	...
} ENTITY;



Skills are actually just var array entries, probably defined somewhere like this:
#define skill1 skill[0]
...
#define skill100 skill[99]

As a result, you can loop over skills just as you guessed:

Code:
for(i = 0; i < 100; i++) my.skill[i] = i;



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Skills Question [Re: Superku] #470438
01/14/18 19:15
01/14/18 19:15
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Yes, I just did a search and it's in compat.h

Thank you! That will help a lot laugh

Last edited by Dooley; 01/14/18 19:17.

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