artbot txt style
 

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

artbot txt style

Started by Skynet, 02 March, 2005, 03:04:47

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Skynet

hi can some tell me why i cant get this to work .what have i done wrong

botname = "-(LOK-BOT-LUA5)-"
lokbot = "add.txt"

function ChatArrival(user,data)
   if string.sub(data, 1, 1) == "<" then
   local data=string.sub(data,1,string.len(data)-1)
   local s,e,cmd = string.find(data, "%b<>%s+(%S+)")

      if cmd == "!add" and (user.bOperator) then
      readfrom(lokbot)
      while 1 do
         line = read()
         if line == nil then break end
         user:SendPM(botname,line)
         end
      readfrom()
      return 1
      end
   end
end

getting this error
\new hub\scripts\art.lua:10: attempt to call global `readfrom' (a nil value)
i got folder name lokbot with add.txt in it hellp

Copyright SkynetSystems 2000-2005 @Phoenix Network

??????Hawk??????

try this m8

botname = "-(LOK-BOT-LUA5)-" 

function ChatArrival(user,data) 
	if string.sub(data, 1, 1) == "<" then 
		local data=string.sub(data,1,string.len(data)-1) 
		local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
			if cmd == "!add" and (user.bOperator) then 
				AddMessage(user)
			end 
		return 1 
	end 
end 

function AddMessage(user)  
			local f,e = io.open("add.txt","r")						 
			local message = "" 
				while 1 do 
					local line = f:read("*l")  
						if line == nil then break 
						else 
							message = message..line.."\r\n"			 
						end 
				end 
			f:close(f)
		user:SendPM(botname,message) 
end




??????Hawk??????

Skynet

Thx Hawk  works well what would it need to send to main chat sorry i am still learning lua5 after geting use to lua4

Copyright SkynetSystems 2000-2005 @Phoenix Network

bolamix

QuoteOriginally posted by Skynet
Thx Hawk  works well what would it need to send to main chat sorry i am still learning lua5 after geting use to lua4
To send to main chat, change this:
user:SendPM(botname,message)
to this:
user:SendData(botname, message)


I think...
Sharing is of the essence!

Live music >> Aiwadirock! live music hub
PtokaX knowledge >> The PtokaX Wiki

Skynet

thank you so much works now simple as that lol i had wording wrong best  i start working on ascii art and adds for the hub  thankyou again :)
Skynet
land of karaoke

Copyright SkynetSystems 2000-2005 @Phoenix Network

Skynet

found one problem with it  no one can type in main chat  tryed a few things but not worked  also made a bit tidy
by adding txt to a folder :>
function AddMessage(user)  
         local f,e = io.open("images/add.txt","r")

any one out now why no one and type in main its got me

Copyright SkynetSystems 2000-2005 @Phoenix Network

bastya_elvtars

It blocked mainchat by default. :P

Fixed (hopefully).

-- fixed by bastya_elvtars

botname = "-(LOK-BOT-LUA5)-" 

function ChatArrival(user,data) 
	local data=string.sub(data,1,string.len(data)-1) 
	local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
	if cmd == "!add" and (user.bOperator) then 
		AddMessage(user)
		return 1 
	end 
end 



function AddMessage(user)  
			local f,e = io.open("add.txt","r")						 
			local message = "" 				while 1 do 
					local line = f:read("*l")  
						if line == nil then break 
						else 
							message = message..line.."\r\n"			 						end 
				end 
			f:close(f)
		user:SendPM(botname,message) 
end
Everything could have been anything else and it would have just as much meaning.

bolamix

Hiya,
To allow typing in mainchat, change
function ChatArrival(user,data) 
	if string.sub(data, 1, 1) == "<" then 
		local data=string.sub(data,1,string.len(data)-1) 
		local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
			if cmd == "!add" and (user.bOperator) then 
				AddMessage(user)
			end 
		return 1 
	end 
end
to
function ChatArrival(user,data) 
	if string.sub(data, 1, 1) == "<" then 
		local data=string.sub(data,1,string.len(data)-1) 
		local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
		if cmd == "!add" and (user.bOperator) then 
			AddMessage(user)
		return 1 
		end 
	end 
end
and btw the script doesn't need to check whether the 1st character is "<" since we're in ChatArrival so...
function ChatArrival(user,data) 
	local data=string.sub(data,1,string.len(data)-1) 
	local s,e,cmd = string.find(data, "%b<>%s+(%S+)") 
	if cmd == "!add" and (user.bOperator) then 
		AddMessage(user)
	return 1 
	end 
end
should work even better ;)
Sharing is of the essence!

Live music >> Aiwadirock! live music hub
PtokaX knowledge >> The PtokaX Wiki

bolamix

Oops took me longer than it did Bast... hardly surprising ^^ :D
Sharing is of the essence!

Live music >> Aiwadirock! live music hub
PtokaX knowledge >> The PtokaX Wiki

Skynet

#9
thx great is working :)

if i am being a pain tell me tryed to edit abit more thought  i had it working and jumped the gun :>

botname "-(LOK-BOT-LUA5)-"
LOKFolder "images" 

function ChatArrival(user,data
	
local data=string.sub(data,1,string.len(data)-1
	
local s,e,cmd string.find(data"%b<>%s+(%S+)"
	
cmd string.sub(cmd1,string.len(cmd))
        if 
io.open(LOKFolder.."/"..cmd..".txt",r) ~= nil then
           AddMessage
(user.cmd)
           return 

	
end 
end 



function AddMessage(user)  
	
	
	
local f,io.open(LOKFolder.."/"..cmd..".txt","r")
	
	
	
	
	
	
 
	
	
	
local message "" 
	
	
	
	
while 
do 
	
	
	
	
	
local line f:read("*l")  
	
	
	
	
	
	
if 
line == nil then break 
	
	
	
	
	
	
else 
	
	
	
	
	
	
	
message message..line.."\r\n"
	
	
	
 
	
	
	
	
	
	
end 
	
	
	
	
end 
	
	
	
f:close(f)
	
	
user:SendPM(botname,message
end 


i am trying to get a folder of txt fill eg add gun etc etc to go to main for all to view like below
 
.
.                                              
.                                                         \ \ ~ ~ 
//
.                                                            ( 0-)
.                                      ----------
oOO-------(_)---------------------------
.                                      
.                                      ---------------------------------
oOO---------------
.                                                           
I__I__I
.                                                            I I   I I
.                                                         ooO Ooo
.
.
.


Error i have now is :>
 Syntax ...nd Settings\Owner\Desktop\new hub\scripts\tester.lua:19: attempt to concatenate global `cmd' (a nil value)

Copyright SkynetSystems 2000-2005 @Phoenix Network

Skynet

sorted script to send to main for all to see posted in finish scripts for all

Copyright SkynetSystems 2000-2005 @Phoenix Network

SMF spam blocked by CleanTalk