chat program help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

chat program help

hi,
I found a chat program that adds icons to a listview but I can only read 1 to 9 number and not 20 or 30 the code is below can u tel me how I cam make it read higher numbers?

s := mid(sData, 1, n - 1);
s2 := mid(sData, n + 1);

for n := low(aChats) to high(aChats) do
if aChats[n].InUse = True then
if aChats[n].Caption = s then
begin
arTemp.SplitIn(s2, ':');
n2 := aChats[n].imgDraw.Canvas.Pen.Color;
n3 := aChats[n].imgDraw.Canvas.Pen.Width;
aChats[n].imgDraw.Canvas.Pen.Color := StrToInt(arTemp.Items[4]);
aChats[n].drawio.Canvas.Pen.Color := StrToInt(arTemp.Items[4]);
aChats[n].imgDraw.Canvas.Pen.Width := StrToInt(arTemp.Items[5]);
aChats[n].drawio.Canvas.Pen.Width := StrToInt(arTemp.Items[5]);
aChats[n].imgDraw.Canvas.MoveTo(StrToInt(arTemp.Items[0]), StrToInt(arTemp.Items[1]));
aChats[n].imgDraw.Canvas.LineTo(StrToInt(arTemp.Items[2]), StrToInt(arTemp.Items[3]));
aChats[n].drawio.Canvas.MoveTo(StrToInt(arTemp.Items[0]), StrToInt(arTemp.Items[1]));
aChats[n].drawio.Canvas.LineTo(StrToInt(arTemp.Items[2]), StrToInt(arTemp.Items[3]));
aChats[n].imgDraw.Canvas.Pen.Color := n2;
aChats[n].imgDraw.Canvas.Pen.Width := n3;
aChats[n].drawio.Canvas.Pen.Color := n2;
aChats[n].drawio.Canvas.Pen.Width := n3;
if not aChats[n].TabSheet2.Showing then
aChats[n].Shape2.Visible := True;
goto Skipper;
end;
end
else if sCommand = 'nick' then // nick room:oldnick:newnick
begin
arTemp.SplitIn(sData, ':', 3);

if high(arTemp.Items) = 2 then
for n := low(aChats) to high(aChats) do
if aChats[n].InUse = True then
if aChats[n].Caption = arTemp.Items[0] then
begin
aChats[n].AddLine('> '+arTemp.Items[1]+' is now '+mid(arTemp.Items[1], 2));
for n2 := 0 to aChats[n].lstMembers.Items.Count - 1 do
if aChats[n].lstMembers.Items.Item[n2].Caption = arTemp.Items[2] then
begin
aChats[n].lstMembers.Items.Item[n2].Caption := mid(arTemp.Items[1], 2);
if IsIgnoring(mid(arTemp.Items[2], 2)) then
aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13
else
case StrToInt(mid(arTemp.Items[2], 1, 1)) of

I CAN USE THE FOLLOWING ICONS BUT ONCE IT PASSES 9 IT WILL NOT HOW THE ICON!

( 0: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 0;
1: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 27;
2: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 29;
3: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 23;
4: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 24;
5: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 25;
6: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 26;
7: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 18;
8: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 19;
9: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 20; }


10: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 16;
11: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 17;
12: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 21;
13: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 22;
14: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 30;
15: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 31;
16: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 32;
17: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 33;
18: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 34;
19: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 35;
20: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 36;
21: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 37;
22: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 38;
23: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 39;
24: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 40;
25: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 12;
26: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13;
27: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 28;
end;
goto Skipper;
end;
end;
end
else if sCommand = 'mode' then // mode room:nick:mode
begin
arTemp.SplitIn(sData, ':', 3);

if high(arTemp.Items) = 2 then
for n := low(aChats) to high(aChats) do
if aChats[n].InUse = True then
if aChats[n].Caption = arTemp.Items[0] then
begin
for n2 := 0 to aChats[n].lstMembers.Items.Count - 1 do
if aChats[n].lstMembers.Items.Item[n2].Caption = arTemp.Items[1] then
if IsIgnoring(arTemp.Items[1]) then
aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13
else
case StrToInt(arTemp.Items[2]) of

0: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 0;
1: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 27;
2: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 29;
3: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 23;
4: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 24;
5: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 25;
6: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 26;
7: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 18;
8: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 19;
9: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 20;
10: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 16;
11: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 17;
12: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 21;
13: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 22;
14: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 30;
15: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 31;
16: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 32;
17: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 33;
18: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 34;
19: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 35;
20: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 36;
21: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 37;
22: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 38;
23: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 39;
24: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 40;
25: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 12;
26: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13;
27: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 28;
end;
aChats[n].GoInsane();
goto Skipper;
end;
end
else if sCommand = 'list' then // list chat:users
begin
n := InStr(1, sData, ':');
if n = 0 then
goto Skipper;
s := mid(sData, 1, n-1);
s2 := mid(sData, n+1);
if Listing then
ChatForm.AddChat(s, s2);
end
else if sCommand = 'gotpm' then // gotim user:message
begin
// JUSTIN YOU IDIOT!
// you took the hamburgular's birthday off monday and thursday!
// which one is it!!!
i := InStr(1, sData, ':');
if i = 0 then
goto Skipper;

s := mid(sData, 1, i - 1); // user
s2 := mid(sData, i + 1); // message

if FormOptions.filterswear.Checked then
s2 := StripSwears(s2);

if FormOptions.ignorepm.Checked then
begin
frmConsole.AddMsg('> Blocked message from ' + s);
SendData('pm ' + s + ':Message ignored, my pm system is off');
goto Skipper;
end;
end;

Comments

  • ManningManning Posts: 1,621Member
    See my comment in red below.

    : hi,
    : I found a chat program that adds icons to a listview but I can only read 1 to 9 number and not 20 or 30 the code is below can u tel me how I cam make it read higher numbers?
    :
    : s := mid(sData, 1, n - 1);
    : s2 := mid(sData, n + 1);
    :
    : for n := low(aChats) to high(aChats) do
    : if aChats[n].InUse = True then
    : if aChats[n].Caption = s then
    : begin
    : arTemp.SplitIn(s2, ':');
    : n2 := aChats[n].imgDraw.Canvas.Pen.Color;
    : n3 := aChats[n].imgDraw.Canvas.Pen.Width;
    : aChats[n].imgDraw.Canvas.Pen.Color := StrToInt(arTemp.Items[4]);
    : aChats[n].drawio.Canvas.Pen.Color := StrToInt(arTemp.Items[4]);
    : aChats[n].imgDraw.Canvas.Pen.Width := StrToInt(arTemp.Items[5]);
    : aChats[n].drawio.Canvas.Pen.Width := StrToInt(arTemp.Items[5]);
    : aChats[n].imgDraw.Canvas.MoveTo(StrToInt(arTemp.Items[0]), StrToInt(arTemp.Items[1]));
    : aChats[n].imgDraw.Canvas.LineTo(StrToInt(arTemp.Items[2]), StrToInt(arTemp.Items[3]));
    : aChats[n].drawio.Canvas.MoveTo(StrToInt(arTemp.Items[0]), StrToInt(arTemp.Items[1]));
    : aChats[n].drawio.Canvas.LineTo(StrToInt(arTemp.Items[2]), StrToInt(arTemp.Items[3]));
    : aChats[n].imgDraw.Canvas.Pen.Color := n2;
    : aChats[n].imgDraw.Canvas.Pen.Width := n3;
    : aChats[n].drawio.Canvas.Pen.Color := n2;
    : aChats[n].drawio.Canvas.Pen.Width := n3;
    : if not aChats[n].TabSheet2.Showing then
    : aChats[n].Shape2.Visible := True;
    : goto Skipper;
    : end;
    : end
    : else if sCommand = 'nick' then // nick room:oldnick:newnick
    : begin
    : arTemp.SplitIn(sData, ':', 3);
    :
    : if high(arTemp.Items) = 2 then
    : for n := low(aChats) to high(aChats) do
    : if aChats[n].InUse = True then
    : if aChats[n].Caption = arTemp.Items[0] then
    : begin
    : aChats[n].AddLine('> '+arTemp.Items[1]+' is now '+mid(arTemp.Items[1], 2));
    : for n2 := 0 to aChats[n].lstMembers.Items.Count - 1 do
    : if aChats[n].lstMembers.Items.Item[n2].Caption = arTemp.Items[2] then
    : begin
    : aChats[n].lstMembers.Items.Item[n2].Caption := mid(arTemp.Items[1], 2);
    : if IsIgnoring(mid(arTemp.Items[2], 2)) then
    : aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13
    : else
    : case StrToInt(mid(arTemp.Items[2], 1, 1)) of
    :
    : I CAN USE THE FOLLOWING ICONS BUT ONCE IT PASSES 9 IT WILL NOT HOW THE ICON!

    [Red]It's because of the line above your comment. mid(arTemp.items[2], 1, 1) will only return 1 character, and of course a single character can not evaluate to a two digit number.[/Red]

    : ( 0: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 0;
    : 1: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 27;
    : 2: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 29;
    : 3: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 23;
    : 4: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 24;
    : 5: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 25;
    : 6: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 26;
    : 7: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 18;
    : 8: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 19;
    : 9: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 20; }
    :
    :
    : 10: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 16;
    : 11: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 17;
    : 12: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 21;
    : 13: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 22;
    : 14: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 30;
    : 15: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 31;
    : 16: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 32;
    : 17: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 33;
    : 18: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 34;
    : 19: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 35;
    : 20: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 36;
    : 21: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 37;
    : 22: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 38;
    : 23: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 39;
    : 24: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 40;
    : 25: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 12;
    : 26: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13;
    : 27: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 28;
    : end;
    : goto Skipper;
    : end;
    : end;
    : end
    : else if sCommand = 'mode' then // mode room:nick:mode
    : begin
    : arTemp.SplitIn(sData, ':', 3);
    :
    : if high(arTemp.Items) = 2 then
    : for n := low(aChats) to high(aChats) do
    : if aChats[n].InUse = True then
    : if aChats[n].Caption = arTemp.Items[0] then
    : begin
    : for n2 := 0 to aChats[n].lstMembers.Items.Count - 1 do
    : if aChats[n].lstMembers.Items.Item[n2].Caption = arTemp.Items[1] then
    : if IsIgnoring(arTemp.Items[1]) then
    : aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13
    : else
    : case StrToInt(arTemp.Items[2]) of
    :
    : 0: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 0;
    : 1: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 27;
    : 2: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 29;
    : 3: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 23;
    : 4: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 24;
    : 5: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 25;
    : 6: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 26;
    : 7: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 18;
    : 8: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 19;
    : 9: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 20;
    : 10: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 16;
    : 11: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 17;
    : 12: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 21;
    : 13: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 22;
    : 14: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 30;
    : 15: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 31;
    : 16: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 32;
    : 17: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 33;
    : 18: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 34;
    : 19: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 35;
    : 20: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 36;
    : 21: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 37;
    : 22: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 38;
    : 23: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 39;
    : 24: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 40;
    : 25: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 12;
    : 26: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 13;
    : 27: aChats[n].lstMembers.Items.Item[n2].ImageIndex := 28;
    : end;
    : aChats[n].GoInsane();
    : goto Skipper;
    : end;
    : end
    : else if sCommand = 'list' then // list chat:users
    : begin
    : n := InStr(1, sData, ':');
    : if n = 0 then
    : goto Skipper;
    : s := mid(sData, 1, n-1);
    : s2 := mid(sData, n+1);
    : if Listing then
    : ChatForm.AddChat(s, s2);
    : end
    : else if sCommand = 'gotpm' then // gotim user:message
    : begin
    : // JUSTIN YOU IDIOT!
    : // you took the hamburgular's birthday off monday and thursday!
    : // which one is it!!!
    : i := InStr(1, sData, ':');
    : if i = 0 then
    : goto Skipper;
    :
    : s := mid(sData, 1, i - 1); // user
    : s2 := mid(sData, i + 1); // message
    :
    : if FormOptions.filterswear.Checked then
    : s2 := StripSwears(s2);
    :
    : if FormOptions.ignorepm.Checked then
    : begin
    : frmConsole.AddMsg('> Blocked message from ' + s);
    : SendData('pm ' + s + ':Message ignored, my pm system is off');
    : goto Skipper;
    : end;
    : end;
    :

Sign In or Register to comment.