advertise on start at PM
 

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

advertise on start at PM

Started by kash?, 05 April, 2005, 18:02:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kash?

I wanted a script which will send any text message
or ascii from the text file at the start of connecting
hub in PM
( text to be displayed is not to be saved in script
but in different text file )

Dessamator

#1
---------------------------------------------------------------------------------- ascii PM sender , on connect
--added newuserconnected, by Dessamator
--by stravides
-- LUA 5 
--03/02/05

sBot = frmHub:GetHubBotName()   --  your main bot here

file1 ="ascii" --name of file
function Main()
   frmHub:RegBot(sBot)
end

function NewUserConnected(user,data)
showtext(user, file1)
end

OpConnected = NewUserConnected

function showtext(user, file)
local contents ="\r\n\r\n"
	for line in io.lines(file..".txt") do
    	contents = contents..line.."\r\n"
    end
		user:SendPM(sBot,"\r\n"..contents.."\r\n|")
end

Done!!

in case u want to add anymore txts, just add two lines :
eg.:
file2 ="ascii2" --name of file
and
showtext(user, file2)

Ignorance is Bliss.

kash?

Unfortunately, it doesn't work m8
Can you please check again....

Dessamator

QuoteUnfortunately, it doesn't work m8  
Can you please check again....

hmm it does work, just follow these 3 steps:

1. create a folder named, "images", in the scripts folder

2. copy a file which u want the users to receive to that folder

3.put the file name here eg.: ascii.txt :
file1 ="ascii" --name of file

(ps the file u select must have an extension of .txt)

 run the script, and reconnect, and voila ull receive ur msg !!!
Ignorance is Bliss.

kash?

#4
I did it earler also and I did it again but
still it doesn't work...:-(

The text file to be displayed can be saved in scripts
folder rather making different folder.....

plz help...

jiten

It's working well with me...

kash?

I am getting this error.....
20: bad argument #1 to `lines' (No such file or directory
)

Dessamator

Done !!, post edited u can put in a normal scripts folder
Ignorance is Bliss.

kash?

I am  getting this error
.lua:22: bad argument #1 to `lines' (No such file or directory)

Dessamator

QuoteOriginally posted by kash?
I am  getting this error
.lua:22: bad argument #1 to `lines' (No such file or directory)
ok, lets c how to solve this, first, post ur script here, with all the changes u made!
Ignorance is Bliss.

kash?

i haven't modified I think.....
this is...
---------------------------------------------------------------------------------- ascii PM sender , on connect
--added newuserconnected, by Dessamator
--by stravides
-- LUA 5
--03/02/05

sBot = frmHub:GetHubBotName()   --  your main bot here

file1 ="ascii" --name of file
function Main()
   frmHub:RegBot(sBot)
end

function NewUserConnected(user,data)
showtext(user, file1)
end

OpConnected = NewUserConnected

function showtext(user, file)
local contents ="\r\n\r\n"
   for line in io.lines(file..".txt") do
       contents = contents..line.."\r\n"
    end
      user:SendPM(sBot,"\r\n"..contents.."\r\n|")
end

Dessamator

ok, and where exactly did u put the file, with the info u want to send?, and whats the name of the file?
Ignorance is Bliss.

kash?

i put that lua file in scripts folder and
and text also in scripts folder with info and
I tried with ascii and ascii.txt also...

Dessamator

QuoteOriginally posted by kash?
i put that lua file in scripts folder and
and text also in scripts folder with info and
I tried with ascii and ascii.txt also...
hmm, the name should be: ascii.txt , and it should be in : \ptokax\scripts
like this :
\(ptokax folder)\scripts\ascii.txt
Ignorance is Bliss.

kash?

I have done as u told me
Still I am getting same error

try some other script for it

regards

jiten

#15
Try this one (put the text files in ur scripts folder alongside the lua files):

--added newuserconnected, by Dessamator
--by stravides
-- LUA 5 
--03/02/05

sBot = frmHub:GetHubBotName()   --  your main bot here

file1 ="asciis" --name of file1

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(user,data)
	showtext(user, file1)
end

OpConnected = NewUserConnected

function showtext(user, filename)
	local contents ="\r\n\r\n"
	local f = io.open(filename..".txt", "r")
	if f then
		for line in f:lines() do
			contents = contents..line.."\r\n"
		end
		f:close()
		user:SendPM(sBot,"\r\n"..contents.."\r\n|")
	else
		user:SendPM(sBot,filename..".txt doesn't exist")
	end
end


Cheers

Dessamator

#16
---------------------------------------------------------------------------------- ascii PM sender , on connect 
--added newuserconnected, by Dessamator 
--by stravides 
-- LUA 5 
--03/02/05 

sBot = frmHub:GetHubBotName() -- your main bot here 

file1 ="ascii.txt" --name of file 
function Main() 
frmHub:RegBot(sBot) 
CreateFile(file1)
end 

function CreateFile(filename)
	if checkfile(filename)=="false" then
		io.output(filename)
		io.output()
		WriteToFile(filename)
	end

end

function NewUserConnected(user,data) 
	showtext(user, file1) 
end 

OpConnected = NewUserConnected 

function showtext(user, file) 
local contents ="\r\n\r\n" 
for line in io.lines(file) do 
contents = contents..line.."\r\n" 
end 
user:SendPM(sBot,"\r\n"..contents.."\r\n|") 
end

function checkfile(filename)
local f = io.open(filename, "r")
	if f then
		f:close()
		return "true"
	else
		return "false"
	end
end
function WriteToFile(filename)
	local file = io.open(filename, "w+") -- "w" write
	file:write("Type ur info here(ps u can delete this line)")
	file:close()
end
 
Done !!

here u go Kash, no need to create a file, just search for "ascii.txt"(without quotation marks), and edit it and put the info you want there !
Ignorance is Bliss.

kash?

#17
thanx guys
Dessamator you script is not working
however it is not showing any errors

jiten ur script is working
but it works only once after starting hub, i.e.if I close dc++ and open it again it doesn't show any text,
that too only I received that ascii and no other
user in hub received it

I want it to work whenever I connect hub and
whoever connect it
 
Is it possible to display two text files (ascii)  

thanx both for help

regards

Dessamator

QuoteOriginally posted by Dessamator
Done!!

in case u want to add anymore txts, just add two lines :
eg.:
file2 ="ascii2" --name of file
and
showtext(user, file2)


Ignorance is Bliss.

SMF spam blocked by CleanTalk