|
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn),
581
guests, and 0
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
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
profmakx
Member
|
Member
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
OP
Serious User
|
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: Getting more than 100 skills without DLL
[Re: profmakx]
#57232
10/16/05 19:31
10/16/05 19:31
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
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: Lion_Ts]
#57234
01/08/07 09:01
01/08/07 09:01
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
Serious User
|
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.
|
|
|
|