Need help with wassup-script, please
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Need help with wassup-script, please

Started by LeChuck, 16 March, 2008, 17:13:32

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LeChuck

Hello scripter,

use PtokaX 0.3.6.0 with RoboCop 10.0.23.
Include "ChatHistoryEntry.lua" makes under \scripts a "ChatHistory.dat" and list on entry in PN last 100 lines. Works great.
Now i want in mainchat by command like "wassup" or "!wassup" after closing PN a new history PN with 50 lines.

This script don't work :
--- HistoryIsSimple by Herodes v1
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 
-- very simple chat history script ..
--- !wazup shows the Chat History

tChatLines = {}
iMaxLines = 50

function ChatArrival(user, data)
	data = string.sub( data, 1, -2) 
	if not string.find( data, "%b<>%s+[%!%?%+%%-%#]" ) then

		local function resort(t) local r={}; for i,v in t do table.insert( r, v );end;return r;end;
		if table.getn(tChatLines) > iMaxLines then
			table.remove(tChatLines, 1);
		end
		table.insert( tChatLines, os.date("%x@%X").." [] "..data );
		tChatLines = resort(tChatLines);
	else
		local s,e, cmd = string.find( data, "%b<>%s+[%!%?%+%%-%#](%S+)" )
		if cmd == "wassup" then
			local m = "\r\n\r\n========================\r\n"
			for i,v in tChatLines do
				m=m.." "..v.."\r\n"
			end
			m = m.."========================"
			user:SendData( "ChatHistory", m)
		end
	end
end


On start :  No syntax errors in script file lua/wassup.lua
After press wassup : Syntax G:\DC\PtokaX_0360\scripts\lua/wassup.lua:13: attempt to call a table value
or press !wassup : Syntax G:\DC\PtokaX_0360\scripts\lua/wassup.lua:23: attempt to call a table value

Can everybody help, please ?   :'(

LeChuck

Nice Mutor, works !  THX

Little error inside.
The HistoryLines sorted by aktual to older, like

03/16/08@16:02:15
03/16/08@16:02:14
03/16/08@16:02:13
03/16/08@16:02:12

What chance to like

03/16/08@16:02:12
03/16/08@16:02:13
03/16/08@16:02:14
03/16/08@16:02:15

LeChuck

Thanks for helping, but no chances.  :'(

LeChuck

UPS, yes, little mistake.

Now works great !  Many Thanks to you !!!  :)

SMF spam blocked by CleanTalk