Pure1993
2008-05-19 08:40:06
Hi,
I was wondering, how exactly do I use the function ChatsBlackText? Because, I want it to save the text of all the line sto an array of string, but it returned an error. I need this because I want to check if someone else is already fighting my target, because if it is, a new black text line appears, and everything gets moved up one. I can't simply use the last black chat, because it would recognise the same one every time until someone writes something. This way, I would check if the text changed, and if it did (for example it all moved up one), it would look in the last line for the needed text.
Thanks A Lot! :D
Pure1993
ZephyrsFury
2008-05-19 09:26:51
ChatsBlackText returns a TStringArray so if you have a TStringArray variable you can just assign the result of ChatsBlackText to it.
var
TheLines: TStringArray;
begin
TheLines := ChatsBlackText;
//etc.
ChatsBlackText returns the lines starting from the top of the chatbox to the bottom. Also the first line is stored in Result[1] not Result[0].
Pure1993
2008-05-19 10:46:21
Thanks a lot, but that didn't entirely solve my problem, well, I will just post the part with the problem out of my script:
function NMFTR(OldArray: TStringArray; NewMessage: string): Boolean;
begin
if OldArray=ChatsBlackText then
begin
Result:=False;
Exit;
end else
begin
if NewMessage = GetBlackChatMessage then {<-- Error Here}
begin
Result:=True;
Writeln(' The text has occured!');
Exit;
end else
Result:=False;
end;
end;
Sir R. M8gic1an
2008-05-19 14:01:06
NewMessage is a String
GetBlackChatMessage return a String Array
read Zephyr's post again and do what he said ;)
TSA:= GetBlackChatMessage
if TSA[High(TSA)] = 'whatever' then…
or TSA[1], not sure in which order it goes.
~RM
Pure1993
2008-05-19 14:07:30
headache… it feels like understanding some of those uber leet scripts all over again… NOOOOOOOOOOOOOO!!!!
But, wait a sec, I think I got it (halfway). So, I could make it save to a TStringArray, and then later, svae it to another TStringArray, and compare them with a "for to do" statement, right? :D JUHU! I fell like an idiot for not understanding Zephy's post completely, but I feel like a genius because I learned something new! xD
ZephyrsFury
2008-05-20 04:53:45
Just so you know you can't compare arrays with a comparisons operators. ie you can't go 'If (NewArray = OldArray) then…'. You need to use a for to do loop to match each element individually.
Also I don't know why you get an error on that line you pointed out above. It should work theoretically. It's the 'if OldArray=ChatsBlackText then' line that should return an error.
Anyways, hope I helped. :)
if OldArray=ChatsBlackText then
begin
Result:=False;
Exit;
end else
begin
if NewMessage = GetBlackChatMessage then {<-- Error Here}
begin
Result:=True;
Writeln(' The text has occured!');
Exit;
assuming that worked
I think you should be doing
if not(findblacktext(intstr(oldarray)) then
blah
i'm kinda drunk, and it' skinda look, and i'm kinda a noob, SO DON'T DISS ME IF IT'Z NOT RIGHTZ LOL
I love you guys.
ZephyrsFury
2008-05-21 06:18:41
From: boxcrop
if not(findblacktext(intstr(oldarray)) then
blah
Lol… No such function as FindBlackText or IntStr. OldArray is an array can't be converted to a string using IntToStr :p