mpl show case
From
dream master@21:1/163 to
All on Saturday, November 05, 2016 02:19:00
ok i was thinking how cool it would be if we showed some of ou
r ways to dothings to help others. i am making an external
editor for voodoo island totest and ill be implementing it i
nto voodoo island for the sysop. this ishow i go about read
ing a .dat file and going up and down a record. there ismore
to add to it but this is the basic form.let's
start out with the type of the data file. this is based off of LoRD
armor.dat i named shield.dat and changed the names of the shield. there are atotal of 15 shields but for this i am using it in default b
ut this will showyou how to edit the name of the armor...
type armorrec = recordname : string; // shouldn't exceed
30 chars!price : longint; // the price of the item
num : longint; // defense needed to buy armor end
Vararmor : armorrec; fptr : file; xx : integer;
ch : char; inp : string;beginxx :=1;//
sets a record number to 1 repeat fassign(fptr, cfgm
pepath + 'voodoo\armor.dat',66); freset(fptr);
if ioresult = 0 thenbegin // the data file exists
fseek(fptr,(xx-1) * sizeof(armor));freadrec(fptr,armor);
writeln('Record : '+int2str(xx););writeln('
[1] Name : '+armor.name);write
ln(' [2] Price : '+int2str(armor.price));
writeln(' [3] Defense : '+int2str(armor.num));
write('|CR Make a selection [123X] :
');end;ch :=upper(readkey);
if ch = '1' then begin// let's us edit armor.name string wri
te('|[X23|[Y11 New Value : '); inp :=input(35,3
5,1,'');; lower(inp); armor.name := inp;
fseek(fptr,(xx-1) * sizeof(armor)); seeks to the record fwr iterec(fptr,armor); fclose(fptr);end;
if ch = '[' then begin if xx <=1 then xx:= xx; else // keeps it
from going to 0 and down xx:= xx-1;end
if ch = ']' then begin if xx >=15 then xx:=xx; else // keeps it f
rom going to 16 and up xx:= xx+1;end
if ch = 'X' thenexit;until ch ='X';end
this will let you go up and down each record and change the name of t hearmor.dat hope this helps others.
.úùDream Masterùú
. øùúùøøùúùø
DoRE!ACiDiC!Demonic[dream
land.darktech.org]
--- Mystic BBS v1.12 A31 (Windows)
* Origin: |08--[|15!|07dreamland BBS dreamland.darktech.org (21:1/163)