Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

what the problem?

Ask for help
Post Reply
-k-
Neophyte
Neophyte
Posts: 41
Joined: 23.01.2012 0:22

what the problem?

Post by -k- »

if 'text' in b.Strings then

the operator 'IN' help me a lot, but don´t work here. =]]]]
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: what the problem?

Post by Vizit0r »

show an example, what you want to do
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
nah nah
Developer
Developer
Posts: 414
Joined: 13.07.2011 11:23
Contact:

Re: what the problem?

Post by nah nah »

Vizit0r wrote:show an example, what you want to do
Полюбасу антимакро ломает :lol:
-k-
Neophyte
Neophyte
Posts: 41
Joined: 23.01.2012 0:22

Re: what the problem?

Post by -k- »

find a specific text in lines GetGumpFullLines

ex:

ResizePics: X Y ID Width Height Page ElemNum
0 ResizePic: 23 471 9200 200 100 0 1
1 ResizePic: 29 516 9200 185 30 0 5
2 ResizePic: 108 476 9200 105 19 0 7
3 ResizePic: 117 476 9200 34 19 0 11
4 ResizePic: 117 476 9200 30 19 0 13
5 ResizePic: 134 476 9200 20 19 0 16
6 ResizePic: 134 476 9200 18 19 0 18
7 ResizePic: 134 476 9200 17 19 0 20
8 ResizePic: 134 476 9200 30 19 0 22
9 ResizePic: 134 476 9200 15 19 0 24
10 ResizePic: 134 476 9200 19 19 0 26
11 ResizePic: 142 476 9200 33 19 0 29
12 ResizePic: 156 476 9200 31 19 0 32
13 ResizePic: 156 476 9200 20 19 0 34
14 ResizePic: 163 476 9200 30 19 0 37
15 ResizePic: 117 476 9200 95 19 0 38
16 ResizePic: 133 476 9200 16 19 0 41
17 ResizePic: 160 476 9200 33 19 0 44
18 ResizePic: 167 476 9200 36 19 0 46

i need find 105 19,

if '105 19' in b.Strings then //"DON`T WORK"
if b.Strings = '2 ResizePic: 108 476 9200 105 19 0 7' then //"WORKS, BUT DOESN'T RIGHT"
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: what the problem?

Post by Vizit0r »

pascal language don't know "in" in such use, as you want.
"in" can be used for check item in set.

for search in string use
1) Pos - http://delphi.about.com/od/beginners/l/blrtlPos.htm
2) BMSearch
BMSearch(StartPos : Integer; const String, Substring : String) : Integer
example:
BMSearch(1, 'dsade', 'de')
will return 4
if find nothing - return zero
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
-k-
Neophyte
Neophyte
Posts: 41
Joined: 23.01.2012 0:22

Re: what the problem?

Post by -k- »

sorry, but what is the problem?

Compiler: [Error] (takegump.sc at 17:29): Type mismatch

Code: Select all

Program test; 
 
var b : TStringList;
i, test : integer;
 
Begin
test := 0;
b := TStringList.Create; 
SetSilentMode(False);
for  i := 0 to GetGumpsCount - 1 do
Begin 
GetGumpFullLines(i,b);
  for i := 0 to b.Count-1 do
  test := test + 1;
    if BMSearch(1, b.Strings[i], 'recado') <> 0 then
    Begin
    addtosystemjournal(test);
    End;
End;
b.free;
End.
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: what the problem?

Post by Vizit0r »

in pascal, strings must be selected by ' '
a := 'sdfdfdfgfdg';
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
grundick
Developer
Developer
Posts: 272
Joined: 31.01.2008 21:16

Re: what the problem?

Post by grundick »

addtosystemjournal(IntToStr(test));
Post Reply