0 Members and 1 Guest are viewing this topic.
function retrievepropertext(text, linesplitter, datasplitter, nds, textontop: string; fillwith, corner, fillx, filly: char): array of string; //nds = new data splittervar s, q, u, y, datalen: byte; bef, af: array of string; i: array of integer; d: array of array of string; //bef and af are SUPPOSED to be "before" and "after" shorts, but their meanings have been altered along the function, sadly.begintext := text + linesplitter; //this MUST be donebef := explode(text,linesplitter);while bef[getarraylength(bef)-1] = nil do setarraylength(bef,getarraylength(bef)-1); //this ALSO MUST be donefor s := 0 to getarraylength(bef)-1 do bef[s] := bef[s] + datasplitter; //this too. heheheaf := explode(bef[0],datasplitter); //just to spare variables.. because I'm poor, ya knowdatalen := getarraylength(af);setarraylength(i,datalen);setarraylength(d,getarraylength(bef));setarraylength(af,getarraylength(bef));setarraylength(result,getarraylength(bef));for s := 0 to getarraylength(d)-1 do setarraylength(d[s],datalen);for s := 0 to getarraylength(af)-1 do begin //main loop af[s] := ''; //clean the variable used temporarily up there heheh for q := 0 to datalen do begin //in this loop, remove the old datasplitter and insert the new one instead (nds) u := pos(datasplitter,bef[s]); af[s] := af[s] + copy(bef[s],1,u-1) + iif(q = datalen,'',nds); delete(bef[s],1,u + length(datasplitter) - 1); end; bef[s] := af[s]; //reciclying variables hehe :p for q := 0 to datalen-1 do begin //in this loop, check which are the lenghthiest data in each line u := pos(nds,bef[s]); if u-1 > i[q] then i[q] := u-1; delete(bef[s],1,u + length(nds) - 1); end; end;for s := 0 to getarraylength(af)-1 do for q := 0 to datalen-1 do begin //in this loop, add the chars (corner etc.) to the result array u := pos(nds,af[s]); for y := u-1 to i[q] do d[s][q] := d[s][q] + iif(y = i[q],'',fillwith); result[s] := result[s] + copy(af[s],1,u-1) + d[s][q] + iif(q = datalen-1,'',nds); delete(af[s],1,u + length(nds) - 1); end;setarraylength(result,getarraylength(result)+2); //add two "blanks" to the result arrayfor s := getarraylength(result)-2 downto 1 do result[s] := result[s-1]; //and now move all text one index upresult[0] := '';i[0] := 0; //again, reciclying variablesfor s := 0 to getarraylength(result)-1 do if length(result[s])+2 > i[0] then i[0] := length(result[s])+2; //i[0] is now the lenghtiest motherfucking linefor s := 1 to i[0]-2 do result[getarraylength(result)-1] := result[getarraylength(result)-1] + fillx; //put some fillingfor s := 1 to (((i[0]-2) div 2) - (length(textontop) div 2)) do result[0] := result[0] + fillx; //fill before the text on topresult[0] := result[0] + textontop; //put the text on topfor s := length(result[0]) to i[0]-3 do result[0] := result[0] + fillx; //fill after the text on topresult[0] := corner + result[0] + corner; //put some motherfucking cornersresult[getarraylength(result)-1] := corner + result[getarraylength(result)-1] + corner; //put some more motherfucking cornersfor s := 1 to getarraylength(result)-2 do result[s] := filly + result[s] + filly; //and box it up to finish it!!end;
var text: string; propertext: array of string; s: byte;begintext := '!Help - Shows how to play the game' + #13#10 + '!Nades - Grants you grenades' + #13#10 + '!Ragequit - Quits the server';propertext := retrievepropertext(text,#13#10,'-','-->',' Commands ',' ','+','-','|');for s := 0 to getarraylength(propertext)-1 do writeln(propertext[s]);
+--------------- Commands ---------------+|!Help --> Shows how to play the game||!Nades --> Grants you grenades ||!Ragequit --> Quits the server |+----------------------------------------+