Author Topic: External files for massive ammounts of variables ~-~~}> SOLVED <{~~-~  (Read 774 times)

0 Members and 3 Guests are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
In my Zomibe RPG script I had/have an array for each skill with a record assigned to it, the array is the max lvl that skill can get, but with a growing ammount of skills there will be 100's of arrayed varaibles. Am i correct that having so may variables will cause major lag or atleast more drag on the cpu and ram? If so I could use an INI to store the info instead and use the ReadINI() from ParrowAZUL (i use his INIFunctions for all logging also) but how would I read the ini kinda like an array?: here is a sample from my INI::
Code: [Select]
[heal]
1cost=1
1mcost=0.02
1minlvl=1
2cost=2
2mcost=0.01
2minlvl=2
3cost=2
3mcost=0.005
3minlvl=3

And here is the same one but using arrays:
Code: [Select]
aheal[1].cost := 1;
aheal[1].mcost := 0.02;
aheal[1].minlvl := 1;
aheal[2].cost := 2;
aheal[2].mcost := 0.01;
aheal[2].minlvl := 2;
aheal[3].cost := 2;
aheal[3].mcost := 0.005;
aheal[3].minlvl := 3;

I would read the information out of the stats INI like this:
Code: [Select]
strtoint(inigetvalue(skills,heal, ?? players[ID].heallvl + 'cost','0'))
Is there a way to get this done? Like make subsections for each level in the ini like this:
Code: [Select]
[heal]
{1}
cost=1
mcost=0.02
minlvl=1
{2}
cost=2
mcost=0.01
minlvl=2
{3}
cost=2
mcost=0.005
minlvl=3

Or would i have to make a section for each seperate level (pain in the neck and harder to read)

Thank you!

After this issue is solved I will relese a beta of my ZPRG script. (ps does a zombie RPG script go in the subgamemode or the fullgamemodes section in SoldatCentral?)
« Last Edit: January 08, 2009, 05:20:45 pm by Hacktank »


Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: External files for massive ammounts of variables
« Reply #1 on: January 08, 2009, 05:20:47 am »
(ps does a zombie RPG script go in the subgamemode or the fullgamemodes section in SoldatCentral?)
(It would be considered as a Full Gamemode)

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: External files for massive ammounts of variables
« Reply #2 on: January 08, 2009, 09:52:07 am »
im not a professional programmer, but already the idea of storing mass amounts of data you'll be accessing a lot in a file on a hard drive... just makes me shiver =/

I'd recommend you sort it out with arrays, just think of an efficient way to handle it all, maybe you can omit some calculations ::)

The current version of my biggest script keeps roughly a thousand values in arrays (probably even more), and it uses only about 11 MB of ram just after start (though it does leak up to about 70 MB, but thats a completely different story :P )

Edit: i mean the server running the script takes that much ram, which almost equals the memory a clean server uses
« Last Edit: January 08, 2009, 09:53:45 am by danmer »

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: External files for massive ammounts of variables
« Reply #3 on: January 08, 2009, 05:19:22 pm »
Ok thanks, if it wont cause lag ill just leave it as arrays, ill put it in soldatcentral and make a thread later. (i just got off school and im hungry/gotta do homework)