Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Getting more than 100 skills without DLL [Re: task1] #57228
10/08/05 12:15
10/08/05 12:15
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
I dont want to make it bad, but remember: arrays are limited! So you cant have a real dynamic system with this.

Re: Getting more than 100 skills without DLL [Re: ] #57229
10/08/05 13:39
10/08/05 13:39
Joined: Nov 2003
Posts: 299
P
profmakx Offline
Member
profmakx  Offline
Member
P

Joined: Nov 2003
Posts: 299
Quote:

Wow, thanks, I need more than a thousand skills for the animation capabilities I'm putting in my light/sound correlation program as I ran out of 100 skills quickly. Variables will not work locally when I'm dynamically creating many of them with the same function, they have a very small max local array count. Do you have the dll code? Thanks again! Your contributions are very helpful LionTs!




I do think you have a different problem if you need 1000 skills...

What exactly are you trying to do?

profmakx

'Unlimited' number of SKILLS without DLL [Re: Lion_Ts] #57230
10/08/05 22:59
10/08/05 22:59
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Proudly present, the 'fast' finalized version, thanks to FRAJO
*DELETED* old code for 100 skills *DELETED*
Fot those who care about script time execution
I'm using in this version some kind of 'linked list'
Code:

define Skills, SKILL60; //define skill for handle storing
entity* GetSetEnt; //pointer for SKILL box entity
string PsEnt=<ps.mdl>; //create very small MDL5 entity (it takes 296 bytes only)
action PsEntAction{ //action for our SKILL box
my.invisible=on; //invisible passable static
my.passable=on;
my.dynamic=off;
}

function GetArr(&Arr, SkillNum){ //helper function to get skill by index
return(Arr[SkillNum]);
}
function SetArr(&Arr, SkillNum, SkillVal){ //helper function to set skill by index
Arr[SkillNum]=SkillVal;
}
function GetSkill(EntName, SkillNum){ //Get SkillNum value for EntName entity
if (!EntName){return(-1);} //No entity, ERROR
if (SkillNum<1){return(-1);} //No Skill, ERROR
GetSetEnt=EntName; //type casting ;)
SkillNum=int(SkillNum); //for a case
if (SkillNum>100){
if (GetSetEnt.Skills==0){ //No entity for skill storing
GetSetEnt.Skills=handle(ent_create(PsEnt,my.x,PsEntAction)); //create it
}
GetSetEnt=ptr_for_handle(GetSetEnt.Skills); //set pointer to next entity
GetSkill(GetSetEnt, SkillNum - 100); //and get skill for next entity
}else{
return(GetArr(GetSetEnt.Skill1, int(SkillNum))); //skill < 100, get it
}
}
function SetSkill(EntName, SkillNum, SkillVal){ //Set SkillNum to SkillVal for EntName entity
if (!EntName){return(-1);} //No entity, ERROR
if (SkillNum<1){return(-1);} //No Skill, ERROR
GetSetEnt=EntName; //type casting ;)
SkillNum=int(SkillNum); //for a case
if (SkillNum>100){
if (GetSetEnt.Skills==0){ //No entity for skill storing
GetSetEnt.Skills=handle(ent_create(PsEnt,my.x,PsEntAction)); //create it
}
GetSetEnt=ptr_for_handle(GetSetEnt.Skills); //set pointer to next entity
SetSkill(GetSetEnt, SkillNum-100, SkillVal); //and set skill for next entity
}else{
SetArr(GetSetEnt.Skill1, SkillNum, SkillVal); //skill < 100, set it
}
return(0); //no ERROR
}
function EntRemoveSkills(EntName){ //remove SKILL box, call this to remove entity, not ent_remove(EntName)
var TempEntHandle=0; //handle for current entity

if (!EntName){return(-1);} //No entity, ERROR
GetSetEnt=EntName; //type casting ;)
if (GetSetEnt.Skills!=0){ //No entity for skill storing
TempEntHandle=handle(GetSetEnt); //store current entity
RemoveSkills(ptr_for_handle(GetSetEnt.Skills)); //remove next entity
}
ent_remove(ptr_for_handle(TempEntHandle)); //remove current entity
return(0); //no ERROR
}


Sorry for posting as answer, edit disabled for me
usage example:
Code:

define MySkill456, 456; //define name for skill456 (56th skill on 4th entity in list)
define MySkill301, 301; //define name for skill301 (1st skill on 3 entity in list)
...
SetSkill(you,MySkill456,1024); //you.skill456=1024
SomeVar=GetSkill(my,MySkill301); //SomeVar=my.skill301
...
SetSkill(my,6,100); //my.skill6=100 :) this and next are useless just for fun
SomeVar=GetSkill(my,6); //SomeVar=my.skill6
...
EntRemoveSkills(me); //ent_remove(me);
...


Feel free to use this stuff.

Re: 'Unlimited' number of SKILLS without DLL [Re: Lion_Ts] #57231
10/09/05 22:58
10/09/05 22:58
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
And thank you guys for pointing me in the right way with skills.

Re: Getting more than 100 skills without DLL [Re: profmakx] #57232
10/16/05 19:31
10/16/05 19:31

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Quote:

What exactly are you trying to do?



-profmakx




I have about 20 paramaters for each created entity (which makes it hard to use global arrays since I'm creating them dynamically), which include scale_x, scale_y, scale_z, pan, tilt, roll, .x, .y, .z, red, green, blue, etc. and I am allowing the user to animate them according to how they want over many frames! That means for each frame, the skill will store the value for each parameter so each object can be animated separately (like in a 3d animation program) but I can only have 2 frames right now because of the low amount of skills I can have. But I can change the animation speed between these two frames so its not so bad. In a .dll tutorial (Grimber's?) it says something about unlimited skills so I'm hoping I won't have to try to use arrays (because it will be much more difficult to program) like you guys are mentioning.

Re: Getting more than 100 skills without DLL [Re: ] #57233
10/18/05 00:53
10/18/05 00:53
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
WING, look closer at my code. No arrays except skills one. It's like a linked list. If you need 201st skill, you'll get 2 entities, 526 - 5. It's a dynamic solution, slower than arrays, but more flexible, i think.

Re: Getting more than 100 skills without DLL [Re: Lion_Ts] #57234
01/08/07 09:01
01/08/07 09:01
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline
Serious User
PrenceOfDarkness  Offline
Serious User

Joined: Aug 2004
Posts: 1,305
New York
although this was over a year ago i decided to leave a comment, because I'm sure new comers will find this very useful, and I went nuts looking for this. Next step will be implementing this for multiplayer use. If anyone really wants to see it work for multiplayer leave a comment or else I wont bother until it's time.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Page 2 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

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