New to scripting
 

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

New to scripting

Started by Cain, 22 August, 2004, 09:45:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cain

Hi, I run a hub on my LAN, I don't have any prior programming experience except just a little bit of C [only uptil loops]

I could appreciate some help on LUA scripting solely for ptokax, I read somewhere on these forums that plop.nl may be what I was looking for but for some reason the site is'nt opening for me......can anyone direct me to some other place that I can use as a starting point?

By the way I'd like to know if there are scripts to -

Add a release which can be deleted by an OP or the user whi created the release

Offline message to a user so when he comes on he'll recieve the message

And

A !seen command showing the date and time the user was last seen but the one which I got is heavily case sensetive.....

Thanx,

|Cain|

Herodes

case sensitive ? how do you mean ?

The rest of the list of scripts you need is around the forum for sure ...

The best to know about Lua for PtokaX is ppl's scripts ... ;))

Also keep looking in the How To section on this Forum and the Scripting.txt in the PtokaX/docs folder ...

Cain

#2
:D It's been quite some time since I am using ptokax and it never occured to me to look in the docs folder - DUH  :O

By case sensetive I mean when I type !seen cain the info does'nt come but when I type !seen Cain it shows the required info.

I will look out for the how to's on the forum, they sound to be exactly what I am looking for, thanx for the help :)

|Cain|

Cain

LOL! My username actually comes from the main character of Bourne identity ;)

here is the script.......

QuoteBotName = "LeonBot"
SeenTrigger = "!seen"

minLen = 4
maxLen = 20
seenArray={}

function Main()
frmHub:RegBot(BotName)
end

function NewUserConnected(curUser)
local boolDisc = 0
if strlen(curUser.sName) < minLen then
curUser:SendPM(BotName, "Your nick is to short, a minimum of "..minLen.." chars is required!")
curUser:SendPM(BotName, "Disconnecting...")
curUser:Disconnect()
boolDisc = 1
elseif strlen(curUser.sName) > maxLen then
curUser:SendPM(BotName, "Your nick is to long, a maximum of "..maxLen.." chars is required!")
curUser:SendPM(BotName, "Disconnecting...")
curUser:Disconnect()
boolDisc = 1
elseif ( strfind (curUser.sName, " ", 1, 1) ) then
curUser:SendPM(BotName, "Spaces not allowed in nicknames!")
curUser:SendPM(BotName, "Disconnecting...")
curUser:Disconnect()
boolDisc = 1
end
if (boolDisc == 0) then
seenArray[curUser.sName]=date(curUser.sName.." connected at %d/%m/%Y %T and is still here.")
end
end

function OpConnected(curUser)
seenArray[curUser.sName]=date(curUser.sName.." connected at %d/%m/%Y %T and is still here.")
end

function OpDisconnected(curUser)
seenArray[curUser.sName]=date(curUser.sName.." disconnected at %d/%m/%Y %T and has not been seen since.")
end

function UserDisconnected(curUser)
seenArray[curUser.sName]=date(curUser.sName.." disconnected at %d/%m/%Y %T and has not been seen since.")
end

function DataArrival(curUser, data)
seenArray[curUser.sName]=date(curUser.sName.." was last seen at %d/%m/%Y %T writing things.")
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
_,_,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
if (cmd == SeenTrigger) then
if (arg == curUser.sName) then
SendToAll(BotName, "You should not do #seen's for yourself ;)" )
elseif (seenArray[arg] ~= nil) then
SendToAll(BotName, "User: "..seenArray[arg] )
else
SendToAll(BotName, "I have not seen "..arg.."!" )
end
end
end
end

Thanx,

|Cain|

nErBoS

#4
Hi,

This will deal with case sensative...

BotName = "LeonBot" 
SeenTrigger = "!seen" 

minLen = 4 
maxLen = 20 
seenArray={} 

function Main() 
frmHub:RegBot(BotName) 
end 

function NewUserConnected(curUser) 
local boolDisc = 0 
if strlen(curUser.sName) < minLen then 
curUser:SendPM(BotName, "Your nick is to short, a minimum of "..minLen.." chars is required!") 
curUser:SendPM(BotName, "Disconnecting...") 
curUser:Disconnect() 
boolDisc = 1 
elseif strlen(curUser.sName) > maxLen then 
curUser:SendPM(BotName, "Your nick is to long, a maximum of "..maxLen.." chars is required!") 
curUser:SendPM(BotName, "Disconnecting...") 
curUser:Disconnect() 
boolDisc = 1 
elseif ( strfind (curUser.sName, " ", 1, 1) ) then 
curUser:SendPM(BotName, "Spaces not allowed in nicknames!") 
curUser:SendPM(BotName, "Disconnecting...") 
curUser:Disconnect() 
boolDisc = 1 
end 
if (boolDisc == 0) then 
seenArray[strlower(curUser.sName)]=date(curUser.sName.." connected at %d/%m/%Y %T and is still here.") 
end 
end 

function OpConnected(curUser) 
seenArray[strlower(curUser.sName)]=date(curUser.sName.." connected at %d/%m/%Y %T and is still here.") 
end 

function OpDisconnected(curUser) 
seenArray[strlower(curUser.sName)]=date(curUser.sName.." disconnected at %d/%m/%Y %T and has not been seen since.") 
end 

function UserDisconnected(curUser) 
seenArray[strlower(curUser.sName)]=date(curUser.sName.." disconnected at %d/%m/%Y %T and has not been seen since.") 
end 

function DataArrival(curUser, data) 
seenArray[strlower(curUser.sName)]=date(curUser.sName.." was last seen at %d/%m/%Y %T writing things.") 
if( strsub(data, 1, 1) == "<" ) then 
data=strsub(data,1,strlen(data)-1) 
_,_,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(%S+)" ) 
if (cmd == SeenTrigger) then 
if (strlower(arg) == strlower(curUser.sName)) then 
SendToAll(BotName, "You should not do #seen's for yourself ;)" ) 
elseif (seenArray[strlower(arg)] ~= nil) then 
SendToAll(BotName, "User: "..seenArray[strlower(arg)] ) 
else 
SendToAll(BotName, "I have not seen "..arg.."!" ) 
end 
end 
end 
end

If you ever get problem because case sensative use strlower(string) in all. This will put all characters with their smal letter.

Best regards, nErBoS
--## nErBoS Spot ##--

Cain

Thanx a bunch :)

|Cain|

SMF spam blocked by CleanTalk