Send Rules from rules.txt
 

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

Send Rules from rules.txt

Started by [NL]ZeroX, 17 March, 2004, 13:58:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[NL]ZeroX

i just want to send the rules from rules.txt whitout getting every line a new line from the txt file

rules.txt: (with the "enters")
rule 1
rule 2
rule 3
rules!!!

than we get the lua code:
if cmd == "!rules" or cmd == "+rules"  then
			SendRules(user)
			return 1

-------------------------------------------------

function SendRules(user) 
	readfrom("txt/rules.txt")
	while 1 do 
		line = read()
			if line == nil then 
				break 
			end 
		user:SendData(Bot,line) 
		end 
	readfrom() 
end

i get as result:
[13:56] <-=[ToXiC?]=-> rule 1
[13:56] <-=[ToXiC?]=-> rule 2
[13:56] <-=[ToXiC?]=-> rule 3
[13:56] <-=[ToXiC?]=-> rules!!!

but i want the results like:
[13:56] <-=[ToXiC?]=-> 
rule 1
rule 2
rule 3
rules!!!

can some1 help me fixt it??


sorry for my crappy engish ;-)

//ZeroX

plop

here are some hints, you try 2 place them on the right place.
local text = "\r\n" --- declare text which is gone hold the full file (starting with a line feed)

text = line.."\r\n" -- insert the line into text ending with a line feed

user:SendData(Bot,text.."|") -- sending the full text
as you see every line has it's comments so it should be easy 2 find there place.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[NL]ZeroX

i dont get it now i'm getting after every rule a break

[18:44] <-=[ToXiC?]=-> rule 1

[18:44] <-=[ToXiC?]=-> rule 2

[18:44] <-=[ToXiC?]=-> rule 3

[18:44] <-=[ToXiC?]=-> rules!!!

(i had it a few hours ago when i was try-ing a lot of things)

my code currentyl says:
function SendRules(user) 
	readfrom("txt/rules.txt")
	while 1 do 
		line = read()
		local text = "\r\n"
			if line == nil then 
				break 
			end 
		text = line.."\r\n"
		user:SendData(Bot,text.."|") 
		end 
	readfrom() 
end

hope some1 can help me out

ZeroX

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

#3
try this m8 :-   ( untested )


function SendRules(user) 
	readfrom("txt/rules.txt")
	local text = "\r\n"
	while 1 do 
		line = read()
			if line == nil then 
				break 
			end 
		text = text.."\r\n"..line
	end 
	user:SendData(Bot,text.."|") 
	readfrom() 
end

[NL]ZeroX

yup thnx m8 its WORKING  8)  :D  :))  :]

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


plop

damn my hints had a bug. lol
but thx for fixing it hawk.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

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

he he he

plop

i learned it all from you and the other great scripters in here m8

unfortunately its taken me 4 months to learn enough to be of some use here, however little it is

SMF spam blocked by CleanTalk