SRL Archive - General

Activation code


HoMoReXuaL

2012-07-06 00:29:52

Hello, im trying to make certain procedures only go once they are activated by a key or password. For example you would type "~" into the chatbox and it would then proceed to other methods. My procedure is not working correctly for some reason. This is what i have -

procedure TriggerCheck;
begin
key := false;
counter := 0;
trigger := '~';
textLine := GetBlackChatMessage;
while (counter < length(textLine)) do
begin
counter := counter +1;
if textLine[counter] = trigger then
key := true
else key := false;
end;
end;

Any help on reasons that it isnt working or tips to fix it would be greatly appreciated, Thanks!

Brandon

2012-07-06 00:36:42

It's because it doesn't read your character's text. You need to either type the text and press enter then black chat message will pick it up or use GetTextATexWrap to get text that is currently being typed

HoMoReXuaL

2012-07-06 00:38:51

The purpose of it was to check if other people say it out loud in the friends chat if thats what you were referring to
And do you think you could shoot me a pm and help me figure out why its not working? its pretty much finished

Brandon

2012-07-06 01:39:26

Like this:


Procedure SomeoneTalked;
var
I: Integer;
begin
FixChat;
OldLine := TheLine;

if(LastChatter(TheName))then
begin
GetLastChatText(TheLine);
if OldLine <> TheLine then
try
For I:= 0 To 5 do
begin
PlaySound('C:\Users\Brandon\Downloads\MSN_Sound.wav');
wait(150);
end;
writeln(TheLine);
except end;
end else
begin
GetLastChatText(TheLine);
if OldLine <> TheLine then
try
For I:= 0 To 5 do
begin
PlaySound('C:\Users\Brandon\Downloads\MSN_Sound.wav');
wait(150);
end;
writeln(TheLine);
except end;
end;
end;


Now you can modify it to check "TheLine" and see if it's your trigger or not. Basically remove the forloop and replace it with your trigger comparison. Something like: If (TheLine == '~') then…..

HoMoReXuaL

2012-07-06 10:36:15

Im kind of new to this and i dont quite understand your code, but i did manage to figure out that the problem with my code was the getblackmessage because i did a write ln of it constantly and it came up with things like ?__ _ || ? when it should be saying "Rayn: ~"