Salut a tous
après un moment d'absence je suis revenus sur mon project initiale
LVL++ mais bon avec plus de recule....
Bref
Suite au code que ma donné Foxy que je remercie au passag:
se code analyse ligne par ligne un fichier text. Moi je voudrais faire un Jump
en gros:
j'aimerais repprendre la lecture sur une ligne précise.
Instruction exemple de mon programme:
msg"Ceci est un test"
--> "good"
msg"Pas de saut"
fin
good:
msg"Saut effectuer"
fin
toute c'est instruction fonctionne normalement sauf une:
--> "good"
vous l'avez compris j'aurais souhaité que l'analyse saute a se moment précis à:
good:
quelqu'un pourrais t'il m'aidé.
Merci d'avance voici mon code:
procedure TEditor.FormCreate(Sender: TObject);
var sprocess3, sGo, sCopy, MSGend: ansistring;
N, msgPos, INT: integer;
ini: TiniFile;
label start;
begin
listbox1.Clear;
self.Caption := ParamStr(1);
if self.Caption = '' then
self.Caption := 'Script Editor by Craft'
else
txtedition.lines.loadfromfile(ParamStr(1));
//=========================================================================
//=========================================================================
begin
txtedition.Lines.BeginUpdate;
try
for N := 0 to txtedition.Lines.Count - 1 do
start:
begin
sGo := txtedition.Lines[N];
sprocess3 := Copy(sgo, 1, 3);
//===================================FIN===================================
if sprocess3 = 'fin' then
Break
//===============================MESSAGEBOX================================
else if sprocess3 = 'msg' then
//Cherche une chaine de caractère commençant par ' " '.
while true do begin // si il y en a une...
msgPos := Pos('"', sGo);
if msgpos <> 0 then begin
sCopy := Copy(sGo, msgPos + 1, Length(sGo));
if pos('"', scopy) > 0 then begin
MSGend := '"' + copy(scopy, 1, pos('"', scopy));
delete(sgo, msgpos + 1, length(MSGend));
end
else break; // pas de fin de chaine marque par guillemet
MSGEND := StrReplace(chr(34), '', MSGend);
showmessage(MSGend); // ---------------dans MSGend ya ton mot
end
else break;
end
//==============================STRING==================================
else if sprocess3 = 'str' then
while true do begin
msgPos := Pos('"', sGo);
if msgpos <> 0 then begin
sCopy := Copy(sGo, msgPos + 1, Length(sGo));
if pos('"', scopy) > 0 then begin
MSGend := '"' + copy(scopy, 1, pos('"', scopy));
delete(sgo, msgpos + 1, length(MSGend));
end
else break;
ini := tinifile.Create('C:\Lvl.ini');
MSGEND := StrReplace(chr(34), '', MSGend);
ini.WriteString('STRING', Msgend, Msgend);
Listbox1.Items.Add('Str: ' + MSGend);
ini.Free
end
else break;
end
//===============================INTEGER================================
else if sprocess3 = 'int' then
while true do begin
msgPos := Pos('"', sGo);
if msgpos <> 0 then begin
sCopy := Copy(sGo, msgPos + 1, Length(sGo));
if pos('"', scopy) > 0 then begin
MSGend := '"' + copy(scopy, 1, pos('"', scopy));
delete(sgo, msgpos + 1, length(MSGend));
end
else break;
ini := tinifile.Create('C:\Lvl.ini');
MSGEND := StrReplace(chr(34), '', MSGend);
INT := strtoint(MSGend);
ini.WriteInteger('INTEGER', Msgend, INT);
Listbox1.Items.Add('Int: ' + MSGend);
ini.Free
end
else break;
end
//===============================JUMP================================
else if sprocess3 = '-->' then
while true do begin
msgPos := Pos('"', sGo);
if msgpos <> 0 then begin
sCopy := Copy(sGo, msgPos + 1, Length(sGo));
if pos('"', scopy) > 0 then begin
MSGend := '"' + copy(scopy, 1, pos('"', scopy));
delete(sgo, msgpos + 1, length(MSGend));
end
else break;
MSGEND := StrReplace(chr(34), '', MSGend);
msgPos := Pos(MSGEND + ':', sGo);
msgPos := n;
goto start;
end
else break;
end
end;
finally
txtedition.Lines.EndUpdate;
end;
end;
end;
La Force 2 La Mao C Sa Diversité