Author Topic: Make a toplist ( see my last post )  (Read 1198 times)

0 Members and 1 Guest are viewing this topic.

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Make a toplist ( see my last post )
« on: November 28, 2009, 11:19:39 am »
Yo,

I have some problems concerning WriteLnFile..

Well, i can succesfuly create an .ini file and write what is supposed to be in this file.

But, new properties can be set and must be replaced, like by exemple :
Test(1) =banana

After it's done, i reset this same var.:

Then it adds in the .ini file; Test(1) =bananaz

But it doesn't replace Test(1), it just adds another one. How is it possible to replace them ?

CHECK MY LAST POST
« Last Edit: December 03, 2009, 07:27:53 pm by VinceBros »

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: WriteFile replacement ?
« Reply #1 on: November 28, 2009, 11:34:20 am »

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: WriteLnFile replacement ?
« Reply #2 on: November 29, 2009, 01:13:01 pm »
I tried it, but it always shows me something like Unknown Identifier iniLoad..
And what is funny about it, it's that i even put the ini script in my script folder (I didn't forget to write it in Includes).
My script can't still recognize functions/procedures from PerroAZUL's INI script..

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: WriteLnFile replacement ?
« Reply #3 on: November 29, 2009, 02:23:58 pm »
are you using the attached file? |:`

ie this actual script: http://forums.soldat.pl/index.php?action=dlattach;topic=22338.0;attach=11534

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: WriteLnFile replacement ?
« Reply #4 on: November 29, 2009, 02:35:18 pm »
Rofl.. I'm not that dumb.
But well it seems like it can detects it, but anyways, i added the script content into mine.
But it just makes my script over 500 lines instead of 300 lol w/e it works. I got some problems with the functions/commands tho.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: WriteLnFile replacement ?
« Reply #5 on: November 29, 2009, 02:37:57 pm »
be sure to put inifuncs.pas or w/e ABOVE your script in includes.txt

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Make a toplist ( see my last post )
« Reply #6 on: December 04, 2009, 05:35:54 pm »
Hai again,

I can store the player's scores in a txt/log file, but i'm not able to replace it, or get the player with the best score.

Thanks for helping me.

(bump)

Here are some info. about the part of the script :

Code: [Select]
   WriteLnFile(CheckDir + CurrentMap + '.log',IDToName(ID) + ' scored in ' + inttostr(minutes[ID]) + ':0' + inttostr(seconds[ID]));
   WriteConsole(ID, 'You finished ' + CurrentMap + ' in ' + inttostr(minutes[ID]) + ':0' + inttostr(seconds[ID]) , $EE35BCE9)

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Make a toplist ( see my last post )
« Reply #7 on: December 05, 2009, 03:49:07 am »
Here is what I use for my toplist, i have a certine contempt for INI files...

Code: [Select]
function XJoin(ary: array of string; splitter: string): string;
var i: integer;
begin
result := ary[0];
for i := 1 to getarraylength(ary)-1 do begin
result := result+splitter+ary[i];
end;
end;

procedure LoadSprees();
var spreefile: array of string; i: integer;
begin
spreefile := xsplit(readfile('scripts/'+scriptname+'/toplist.txt'),chr(13)+chr(10));
for i := 1 to toplist do begin
if i <= getarraylength(spreefile)-1 then begin
topsprees[i] := strtoint(getpiece(spreefile[i-1],' ',0));
topnames[i] := getpiece(spreefile[i-1],getpiece(spreefile[i-1],' ',0)+' ',1);
end else begin
topsprees[i] := 0;
topnames[i] := '';
end;
end;
end;

procedure SaveTopList();
var i: integer; output: array[1..toplist] of string;
begin
for i := 1 to toplist do begin
output[i] := inttostr(topsprees[i])+' '+topnames[i];
end;
writefile('scripts/'+scriptname+'/toplist.txt',xjoin(output,chr(13)+chr(10)))
end;


Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Make a toplist ( see my last post )
« Reply #8 on: December 05, 2009, 11:32:20 am »
I don't have that much skills in scripting, either sorting and lists. That would require some more help, thanks :)