program New;
{Copy RHQ table (page by page, 11 of them) into a text file.
Set name and location of that text file in const.
Be careful how you copy them. I recommend copying the row above also
(Name etc) so that the spacing stays the same, just in case
(obviously delete that line once in text file). Just make sure
that spaces and chr(13)'s stay where they were.
Hit run, allow access to files. When it's done look in
SCAR folder for monster.ini. :)
}
const FileName='C:\monsters.txt';
var i,startfile,i2,i3:integer;
ordnum:byte;
mystrings:array [0..7] of string;
eom1,endofmonster,endofname,eon1,endofnamedone:boolean;
ans,ans2,anstemp,monstername:string;
begin
startfile:=openfile(FileName,true);
repeat
i:=i+1;
ans2:='';
endofmonster:=false;
eom1:=false;
endofname:=false;
eon1:=false;
endofnamedone:=false;
for i2:=0 to 7 do
mystrings[i2]:='';
i2:=0;
repeat
ReadFileString(startfile,ans,1);
ordnum := getkeycode(ans[1]);
if (ordnum=13) and (eom1) then
endofmonster:=true;
if (ordnum=13) and (not eom1) then
eom1:=true;
if (ordnum=9) and (eon1) then
endofname:=true;
if (not endofnamedone) and (ordnum=32) and (not eon1) then
eon1:=true;
ans2:=ans2+ans;
if endofnamedone and (ordnum=9) then
ans2:='';
if (endofnamedone and ((ordnum=32) or((ordnum=13))) ) then
begin
anstemp:=trim(ans2);
anstemp:= replace(anstemp,chr(13),'');
anstemp:=replace(anstemp,chr(9),'');
anstemp:=replace(anstemp,chr(55),'');
mystrings[i2]:=anstemp;
i2:=i2+1;
end;
if not(endofnamedone) and (endofname) then
begin
delete(ans2,length(ans2)-1,length(ans2));
for i3:=1 to length(ans2) do
begin
if getkeycode(ans2[i3])=13 then
delete(ans2,i3,i3);
end;
monstername:=ans2;
ans2:='';
endofnamedone:=true;
end;
until endofmonster or (i2=8);
writeini(monstername,'Name',monstername,apppath+'monster.ini');
writeini(monstername,'Combat Level',mystrings[0],apppath+'monster.ini');
writeini(monstername,'Members Only',mystrings[1],apppath+'monster.ini');
writeini(monstername,'HP',mystrings[2],apppath+'monster.ini');
writeini(monstername,'XPC',mystrings[3],apppath+'monster.ini');
writeini(monstername,'XPA',mystrings[4],apppath+'monster.ini');
writeini(monstername,'CXP',mystrings[5],apppath+'monster.ini');
writeini(monstername,'SXP',mystrings[6],apppath+'monster.ini');
writeini(monstername,'SLXP',mystrings[7],apppath+'monster.ini');
until i=100;
closefile(startfile);
end.
If you could make something to search the INI, like the RHQ one does, that would be awesome.