Author Topic: Need help with wassup-script, please  (Read 2858 times)

0 Members and 1 Guest are viewing this topic.

Offline LeChuck

  • Junior Member
  • **
  • Posts: 12
  • Karma: +1/-0
Need help with wassup-script, please
« on: 16 March, 2008, 17:13:32 »
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 :
Code: [Select]
--- 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 ?   :'(

PtokaX forum

Need help with wassup-script, please
« on: 16 March, 2008, 17:13:32 »

Offline LeChuck

  • Junior Member
  • **
  • Posts: 12
  • Karma: +1/-0
Re: Need help with wassup-script, please
« Reply #1 on: 16 March, 2008, 19:45:15 »
Nice American Idiot, 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

Offline LeChuck

  • Junior Member
  • **
  • Posts: 12
  • Karma: +1/-0
Re: Need help with wassup-script, please
« Reply #2 on: 17 March, 2008, 19:47:29 »
Thanks for helping, but no chances.  :'(

Offline LeChuck

  • Junior Member
  • **
  • Posts: 12
  • Karma: +1/-0
Re: Need help with wassup-script, please
« Reply #3 on: 17 March, 2008, 21:19:16 »
UPS, yes, little mistake.

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

PtokaX forum

Re: Need help with wassup-script, please
« Reply #3 on: 17 March, 2008, 21:19:16 »