+help command *Need help, change script*
 

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

+help command *Need help, change script*

Started by pizzamonstret, 26 December, 2004, 16:01:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pizzamonstret

Hello there...  ?(

I need help with this script --->
------------------------------------------------------------------------------------------------------------------------------------------------

botname = "-DvD][SWE-"

function Main()
frmHub:RegBot(botname)
end

function DataArrival(user,data)
if strfind(data, "+rules",1,1) then
readfrom("rules.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(botname,line)
end
readfrom()
end
end

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

When I type +rules, then the bot sends me a PM with all the rules BUT the name om the bot is infront of every line.
It looks like this for example --->

------------------------------------------------------------------------------------------------------------------------------------------------
<-DvD][SWE-> #01:   Slot rule. min 2 slots max 10slots MAX 4 Slot`s if your upload is lower then 1Mbit!!
<-DvD][SWE-> #02:   10 GB minshare.
<-DvD][SWE-> #03:   Max 8 hubs.
------------------------------------------------------------------------------------------------------------------------------------------------

Like I said, bot name infront of every line.. I want the botname in the top of the message and not everywhere in the message. (Just ONE botname)..

Could someone please help me with this?

Thanks  8)

enema

Try this one, but make sure you copy rules in right place (every line should start with msg = msg.."\t\t and end with \r\n")

\t stands for tab, r\ for return... not sure, what does n\ means.. lol :D

--- info bot made by enema. sends anykind of info in PM when cmd is recived
--- date - 26.12.2004
----------------------------------------------------------------

msg=""
msg = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
msg = msg.."\t\t"..frmHub:GetHubName().."\r\n"
msg = msg.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
msg = msg.."\t\t                   COPY THE RULES HERE ONE LINE BY ONE			\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t\t									\r\n"
msg = msg.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"

prefix = "+"
bot = "-DvD][SWE-"

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then 
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
		if cmd == prefix.."rules" then 
			user:SendPM(bot, msg)
		return 1
		end
	end
end

havent tested it, but should work..

bolamix

Hi,

I use this:
--Made by Piglja(Just learning;P )
--Many thanks to aMustex 4 being so patient and with helping 4 some probs within the script:)
--Bits and pieces added by bolamix for Aiwadirock!

botname = "your-bots-name"
--De-anonymize your bot
bot_email = "whatever"
bot_speed = "whatever"
bot_descr = "whatever"
gb = 0 * 1024 * 1024
bot_share_size = 0 * 1024 * gb
--You must have a folder named "helpfiles" inside your Ptokax scripts folder
--Put your rules.txt and other files in there
rules = "helpfiles/rules.txt"

function Main()
	frmHub:RegBot( botname )
	my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$ $"..bot_speed..strchar(1).."$"..bot_email.."$"..bot_share_size.."$"
end

function DataArrival(user, data)
	if (strsub(data, 1, 1) == "<") then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="+rules") then
			Help(user, rules)
			return 1
		end
	end
end

function NewUserConnected(user)
	user:SendData( my_info_string )
end

function OpConnected(user)
	user:SendData( my_info_string )
end


function Help(user, UserFile)
   	local filecontents = ""
	local handle = openfile(UserFile, "r")
	if (handle ~= nil) then
		local line = read(handle)
		while line do
        	filecontents = filecontents..line.."\r\n"
		line = read(handle)
		end
		closefile(handle)
      	user:SendPM(botname, filecontents)
	end
end
You can add many commands linking to as many help files, and they'll all show with the name of the bot once only, on the first line. Hope this helps ;)

And \n is for New line i think. Which kinda doubles with \r, i know. But there must be a reason ;)
Sharing is of the essence!

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

pizzamonstret

#3
Thanke you very much enema. It works fine..

I owe you one ;)

SMF spam blocked by CleanTalk