You want to make some sort of dicing bot? When your "friend" or better said the owner of the CC says !dice then it rolls a dice between 1-100?
You really need to look into arrays and FindChatBoxTextEx. Then compare the results from i = 8 downto 1 in the array. Or only roll when the text is at line 8 or 7. GetBlackChatMessage could also be used once you look into arrays it should be fairly simple to make.
Well I'm in the train anyways and not much else to do so here you go
Simba Code:
program NameComparer;
{$i SRL/SRL.simba}
const
HostName = 'Host Scumbag';
DiceMessage = '!roll';
function GetLastChatLines: Array[0..1] of String;
var
i: Integer;
begin
for i:=8 downto 7 do
Result[i-7] := GetChatBoxText(i, clBlack);
end;
function NeedToRoll: boolean;
var
i: Integer;
Texts: Array[0..1] of String;
begin
Texts := GetLastChatLines;
for i:=0 to high(Texts) do
if Pos(HostName, Texts[i]) > 0 then
if Pos(DiceMessage, Texts[i]) > 0 then
begin
Result := True;
break;
end;
end;
begin
while LoggedIn do
if NeedToRoll then
begin
TypeSendEx(IntToStr(RandomRange(1, 100)), True);
Wait(RandomRange(2000, 3000));
end;
end.
Should work, note that someone could imitate the host.
Eg. RS_Lover2001 could say Host Scumbag !roll to make it roll. To avoid this you can do some stuff like checking the length of the string and the positions. But other than that I guess this will work.
If you weren't making a dicing bot then it's still a good example.