procedure verifygump;
var i,loop,loop2,cont : integer;
GumpLines : TStringList;
begin
i := 0;
cont := 0;
While (i = 0) do //as 'i' is equal to '0'
begin
cont := cont + 1;
if IsGump then //if Gump
begin
GumpLines := TStringList.Create; // create a list.
Wait(1000);
loop := 0;
For loop := 0 to GetGumpsCount-1 do //go through all active gumps.
begin
If (GetGumpSerial(loop) = SelfId) then //Gump is the loop position is equal to the serial character
begin
GetGumpfullLines(loop,GumpLines); //Add Gump all lines of the GumpLines
for loop2 := 0 to GumpLines.Count-1 do //Will read and compare all lines added to GumpLines
begin
If (GumpLines.Strings[loop2] = 'texto 1') or (GumpLines.Strings[loop2] = 'texto 2') then // in the Gump has these two string
begin
ClientPrint(inttostr(loop1)+' '+GumpLines.Strings[loop2]);
// i := i + 1; // Increments the variable I, Causing the while is deactivated.
ClientPrint('successful'); // successful
Repeat
Wait(100);
Until Not IsGump;
end;
end;
end;
end;
end;
ClientPrint('Verificando... '+IntToStr(cont));
Wait(5000); //security pause
end;
end;
the problem is that after this script spends time running.
it stops working.
could someone please help me.
Some have solution?
I would like to also know what is the correct way to run more than one script at a time.
as closing the menu via script?
example: tracking menu.
procedure verifygump;
var i,loop,loop2,cont : integer;
GumpLines : TStringList;
begin
i := 0;
cont := 0;
While (i = 0) do //as 'i' is equal to '0'
begin
cont := cont + 1;
if IsGump then //if Gump
begin
GumpLines := TStringList.Create; // create a list.
Wait(1000);
loop := 0;
For loop := 0 to GetGumpsCount-1 do //go through all active gumps.
begin
If (GetGumpSerial(loop) = SelfId) then //Gump is the loop position is equal to the serial character
begin
GetGumpfullLines(loop,GumpLines); //Add Gump all lines of the GumpLines
for loop2 := 0 to GumpLines.Count-1 do //Will read and compare all lines added to GumpLines
begin
If (GumpLines.Strings[loop2] = 'texto 1') or (GumpLines.Strings[loop2] = 'texto 2') then // in the Gump has these two string
begin
ClientPrint(inttostr(loop1)+' '+GumpLines.Strings[loop2]);
// i := i + 1; // Increments the variable I, Causing the while is deactivated.
ClientPrint('successful'); // successful
Repeat
Wait(100);
Until Not IsGump;
end;
end;
end;
end;
end;
ClientPrint('Verificando... '+IntToStr(cont));
Wait(5000); //security pause
end;
end;
the problem is that after this script spends time running.
it stops working.
could someone please help me.
Some have solution?
I would like to also know what is the correct way to run more than one script at a time.
as closing the menu via script?
example: tracking menu.
u should free the TStringList object...
And can't you use just events?
it's much more simpler.
Try to avoid using more than 1 script at the moment.
Re: Help with gumps detection repetition.
Posted: 10.06.2016 0:52
by Hisered
drabadan wrote:
u should free the TStringList object...
And can't you use just events?
it's much more simpler.
Try to avoid using more than 1 script at the moment.
1. you could give an example of the release of TStringList object please
2. you could give an example of how to use events please
3. I will try
thank you!
Re: Help with gumps detection repetition.
Posted: 10.06.2016 9:36
by Vizit0r
1. you could give an example of the release of TStringList object please
procedure verifygump;
var i,loop,loop2,cont : integer;
GumpLines : TStringList;
begin
i := 0;
cont := 0;
GumpLines := TStringList.Create; // create a list.
While (i = 0) do //as 'i' is equal to '0'
begin
....
end;
GumpLines.Free;
end;
2. you could give an example of how to use events please
procedure OnGumpIncoming(Serial, GumpID, X, Y: Cardinal);
begin
AddToSystemJournal('hey guys, we have a new gump here!');
end;
begin
SetEventProc(evIncomingGump, 'OnGumpIncoming');
while true do wait(1000);//infinite cycle, otherwise if script stop - event cant be executed.
end.
Re: Help with gumps detection repetition.
Posted: 10.06.2016 21:30
by Hisered
I ended up making the code from scratch !.
Amazingly it worked !.
I can not explain why tava not working before.!