L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script that read the chat messages
Author Message
carlosdiegao Offline
Elpy
*

Posts: 3
Joined: Jan 2014
Reputation: 0
Version: 1.4.3.143
Post: #1
Script that read the chat messages

Hi guys.
Is there a way to create a script that reads the chat messages?
I am playing a server that have a captcha validation by random time... But when captcha appears, I get a message from system like this: "You have 90 seconds to choose the correct..."

So I want to create a script that when this dialog appears, a alert sound starts... With this I can hear the alert and click in the correct alternative.


Thx.
08-13-2016 04:24 AM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #2
RE: Script that read the chat messages

idk if correct is code, dont have even normal editor, to make work u need:
1. add sound with name alarm.wav in tower temp folder
2. edit string bwllow in code, it will search a part of text, so u dont need full text
3. type ig /alarm

if u know bit lua u will make it work gl

    LUA Programming
function OnCreate()
	this:RegisterCommand("alarm", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
	AlarmStatus = false;
	LastAlarmTime = 0;
	LastAlarmT = 10;
 
	CheckSound = GetDir() .. "\\temp\\alarm.wav";
end;
 
 
 
function OnCommand_alarm(vCommandChatType, vNick, vCommandParam)
	if (AlarmStatus == false) then
		AlarmStatus = true;
		ShowToClient(tostring(os.date("%X")),"Alarm Plugin ON",3 );
	else
		AlarmStatus = false;
		PeopleInPartyCount = nil
		ShowToClient(tostring(os.date("%X")),"Alarm Plugin OFF",3);
	end;
end;
 
 
function FindSubStringInString(thesub,thestring) 
	for x = 1, 1 + string.len(thestring)-string.len(thesub),1 do
		if (string.sub(thestring,x,x+string.len(thesub)-1) == thesub) then
			return true;
		end;
	end;
	return false;
end;
 
 
function OnChatUserMessage(chatType, nick, msg)
	if (AlarmStatus == true) then
		Message = string.lower(msg); -- Converts message to lower case letters.
		Message = Message:gsub("^%s*(.-)%s*$", "%1"); -- Trimming message of spaces on start.
		if FindSubStringInString("ur string to search",Message) then-- edit here
			if (LastAlarmTime + LastAlarmT < os.time()) then
				PlaySound(CheckSound);
			end;
		end;
	end;
end;


PUSH [Image: knUu53] IF HELPED
08-13-2016 11:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
carlosdiegao Offline
Elpy
*

Posts: 3
Joined: Jan 2014
Reputation: 0
Version: 1.4.3.143
Post: #3
RE: Script that read the chat messages

(08-13-2016 11:17 AM)TheQQmaster Wrote:  idk if correct is code, dont have even normal editor, to make work u need:
1. add sound with name alarm.wav in tower temp folder
2. edit string bwllow in code, it will search a part of text, so u dont need full text
3. type ig /alarm

if u know bit lua u will make it work gl

    LUA Programming
function OnCreate()
	this:RegisterCommand("alarm", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
	AlarmStatus = false;
	LastAlarmTime = 0;
	LastAlarmT = 10;
 
	CheckSound = GetDir() .. "\\temp\\alarm.wav";
end;
 
 
 
function OnCommand_alarm(vCommandChatType, vNick, vCommandParam)
	if (AlarmStatus == false) then
		AlarmStatus = true;
		ShowToClient(tostring(os.date("%X")),"Alarm Plugin ON",3 );
	else
		AlarmStatus = false;
		PeopleInPartyCount = nil
		ShowToClient(tostring(os.date("%X")),"Alarm Plugin OFF",3);
	end;
end;
 
 
function FindSubStringInString(thesub,thestring) 
	for x = 1, 1 + string.len(thestring)-string.len(thesub),1 do
		if (string.sub(thestring,x,x+string.len(thesub)-1) == thesub) then
			return true;
		end;
	end;
	return false;
end;
 
 
function OnChatUserMessage(chatType, nick, msg)
	if (AlarmStatus == true) then
		Message = string.lower(msg); -- Converts message to lower case letters.
		Message = Message:gsub("^%s*(.-)%s*$", "%1"); -- Trimming message of spaces on start.
		if FindSubStringInString("ur string to search",Message) then-- edit here
			if (LastAlarmTime + LastAlarmT < os.time()) then
				PlaySound(CheckSound);
			end;
		end;
	end;
end;


Man, thx for the solution. It works fine. But the problem now is other Smile
It appears that function OnChatUserMessage its between client and server. Because it, all this work does not work... I guess the message that I said is generated only in my game (maybe by gameguard...). In this case i need to get the local messages, for example, messages that only me can see, Messages like Tower messages (System: Bot on).

Thx a lot.
08-15-2016 01:31 AM
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 642
Version: 1.4.2.133
Post: #4
RE: Script that read the chat messages

Where is problem ?

    LUA Programming
function OnChatSystemMessage(id, msg)
	--Event called some system message show up on chat (id - integer, msg - string).
end;


PUSH [Image: knUu53] IF HELPED
08-15-2016 08:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
carlosdiegao Offline
Elpy
*

Posts: 3
Joined: Jan 2014
Reputation: 0
Version: 1.4.3.143
Post: #5
RE: Script that read the chat messages

(08-15-2016 08:02 AM)TheQQmaster Wrote:  Where is problem ?

    LUA Programming
function OnChatSystemMessage(id, msg)
	--Event called some system message show up on chat (id - integer, msg - string).
end;


So... I will try to explain...
It appears that the dialog who shows the captcha is the same dialog from the Tutorial... When we start the game with a new character, the Tutorial Dialog appears, and We can't catch his content.
Yesterday I tried OnChatSystemMessage, and i get success. But the problem persist with tutorial dialog.

Look, I guess the problem that i cant catch the captcha html is the same problem that i can't catch the html from l2tower box... Its appears that I can't get local htmls, but i can get incomming html.

When I Log into game, after character selection, the game show:

" Espoliador: Vote us every day. "

Espoliador is my nick! And i can't get this message, i don't know why... And when I get captcha moment is:

"Espoliador: you have 30 seconds to choose the correct..."

It appears a local message (generated from gameguard, i guess it), like messages generated from l2tower, who's we can read but we can't catch....
08-15-2016 15:59 PM
Find all posts by this user Quote this message in a reply
benbt91 Offline
VIP Member
***

Posts: 694
Joined: Mar 2012
Reputation: 47
Version: 1.4.3.143
Post: #6
RE: Script that read the chat messages

which server l2tower still support guys ?
09-07-2016 21:51 PM
Find all posts by this user Quote this message in a reply
bable Offline
Expired VIP Member
**

Posts: 2
Joined: Sep 2016
Reputation: 0
Version: 1.4.2.133
Post: #7
RE: Script that read the chat messages

nice
09-07-2016 21:53 PM
Find all posts by this user Quote this message in a reply
testforl2 Offline
Expired VIP Member
**

Posts: 259
Joined: Jun 2013
Reputation: 40
Version: 1.4.3.143
Post: #8
RE: Script that read the chat messages

How many Chat-types variables exist? Is there a command to include all of them? I mean what someting like chattype= ALL etc...
I am looking for a similar solution like the thread starter.
12-10-2017 19:15 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pluguin Chat command for start and stop Scrypt OxenteBahia 1 2,498 08-24-2015 22:45 PM
Last Post: schubbel2208
WTB WTB chat script abl521 0 1,746 03-01-2015 17:50 PM
Last Post: abl521
  Chat command buffing? NNBoT 2 2,950 10-03-2014 16:29 PM
Last Post: NNBoT
  Yellow chat in game astra1 2 2,990 08-29-2014 11:43 AM
Last Post: astra1
  help me pliss, start stop bot x chat party celes82113 4 3,544 03-09-2014 06:24 AM
Last Post: Fox
Exclamation Ingame Chat - Just a Security Risk? YulRun 2 2,932 12-27-2013 13:21 PM
Last Post: Grond
Sad Folders CHAT & REPORTS capucine 1 2,098 10-06-2013 16:39 PM
Last Post: ClockMan
  OnChatUserMessage: crashes if multiple messages appear aclime 5 3,621 03-17-2013 18:21 PM
Last Post: TheBl4ckPhoenix
  chat log recording giggidy 5 5,272 10-15-2012 07:49 AM
Last Post: Hebdzik
Information Say im pm, he said in party chat?!?!? alsnazevedo_118 11 9,609 09-12-2012 12:57 PM
Last Post: Hebdzik



User(s) browsing this thread: 1 Guest(s)