Need a quik short 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

Need a quik short script

Started by QuikThinker, 07 June, 2004, 20:29:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

QuikThinker

Hey guys,
Need a quik script so when sum1 types +help it triggers the bot 2 say "-------> !userhelp"

Thanx in advance,
Quik.

Herodes

#1
Sorry Double Posting by mistake .. :(

Herodes

--- Quick Short UserHelp not Help
--- Quick request from QuickThinker
--- b Herodes
botname = "Please-Use"

function DataArrival(user, sdata) 			 	 	--- On Data Arrival
if ( strfind(sdata, 1, 1) == "<" ) then 			 	--- if in Main Chat
	local sdata = strsub(sdata, 1, (strlen(sdata)-1)) 	--- Take out the pipe  ( pipe is the character : " | "  )
	local s,e,cmd = strsub(sdata, "%b<>%s+(%S+)") 	--- find the message/cmd
		if (cmd ~= nil and cmd == "+help") then  	--- if the message isn't nil and the message is our cmd then	
			user:SendData(botname, "-u-s-e--c-m-d-> !userhelp")	--- Send (private) msg to the Main Chat of the user  
		end 				 	 	 	 	 	--- end the find if cmd part ...
end 	 	 	 	 	 	 	 	 	 	 	--- end the if main chat msg part ...
end 	 	 	 	 	 	 	 	 	--- end the Data Arrivals function ...

I think it should be done like this ... although I am still learning
...  and mistake is very probable as DataArrival is a critical part of every script
.... and strsub, strfind etc. are very delicate ...
So, if someone wants to correct ...  By All Means .... :D

QuikThinker

Just tested it mate & it dun seem 2 work :(

VidFamne

Think its a typo there; should be strfind instead of strsub
in there;
local s,e,cmd = strfind(sdata, "%b<>%s+(%S+)")

QuikThinker

lol nope, that dun work either! And if im right, this script will PM the user?
All I need is just a VERY basic triggerbot kinda thing that just says "-----> !userhelp" in main chat window when sum1 types "+help"

Sum1 must be able 2 do this? lol

Quik.

G?M

QuoteOriginally posted by QuikThinker
lol nope, that dun work either! And if im right, this script will PM the user?
All I need is just a VERY basic triggerbot kinda thing that just says "-----> !userhelp" in main chat window when sum1 types "+help"

Sum1 must be able 2 do this? lol

Quik.

user:SendData does NOT send a PM to whoever types it, it will show up in the MAIN chat window, but only the person who typed +help will be able to see the message.

If you want it to be seen by everyone replace user:SendData with SendToAll
The more I drink, the more I realize I like to Drink.
                                                                          -G?M

QuikThinker

OK thats cool but it STILL doesnt work :s

G?M

Bot = "whateveryouwant"
prefix = "+"

function Main()
--frmHub:RegBot(Bot) remove the --'s to make the bot show in main
end


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.."help" then
            -- this will be sent to ALL users change it to user:SendData to send it 
            -- privately in MAIN chat 
			SendToAll(Bot,"Please type !userhelp "..user.sName.." for the help menu")
end
end
end

try this one ;)
The more I drink, the more I realize I like to Drink.
                                                                          -G?M

VidFamne

#9
Sorry for deleted my previous post but the code was not
function properly. Hope this will;
function DataArrival(curUser,sData)
	if strsub(sData,strlen(curUser.sName)+4,strlen(curUser.sName)+9)=="+help|" then
	SendToAll("HelpBot","Please use the command --> !userhelp")
	end
end

QuikThinker

Gismo top man! Absolutely perfect!
Thanx 4 tryin also Herodes, appreciated.

Quik.

Herodes

#11
Just for comparison,
And for all apart the Pm part is the same ...
Always with the explanatory part ..
It's is helpfull to know what is going on inside the small scripts ...
giving clues to ppl always help ...
I just  looked at the progression of the thread .. I was coming to post mine...
so there it is .. (basically the same DataArrival and cmd picking but no prefix var in mine) ...
--- Quick Short UserHelp not Help
--- Quick request from QuickThinker
--- b Herodes
botname = "Please-Use"

function Main() ------------------------------if PMing a user then  its is neccessary to register  
frmHub:UnregBot(botname)-------------- the Bot because I 'm prety sure that 
frmHub:RegBot(botname)----------------- most of the users have set DC++ not to receive pms from offline user. . :)
end--------------------------------------------- end Main() function

function DataArrival(user, sdata) 			 	 
if ( strsub(sdata, 1, 1) == "<" ) then ------------------------------------------------------------------------1 	When data arrives in Main Chat... 
	sdata = strsub(sdata, 1, (strlen(sdata)-1)) ------------------------------------------------------2 	remove their last character (pipe = " | ")
------------------------------------------------------------------------------------------------------------------ ? /=	the cmd(' (%S+) ') comes after spaces ( ' %s+ ' ) 
	s,e,cmd = strfind(sdata, "%b<>%s+(%S+)") -------------------------------------------------- 3 =	that come after a pattern 
------------------------------------------------------------------------------------------------------------------ ? \=	that resembles the nick ( ' %b<> ' )
	if cmd ~= nil then ----------------------------------------------------------------------------------4 	if the message isn't nil and
		if cmd == "+help" then -----------------------------------------------------------------5 	the message is our cmd then	
			user:SendPM(botname, "-u-s-e--c-m-d-> !userhelp") --------------------6 	Send (private) msg to the Main Chat of the user  
		end ----------------------------------------------------------------------------------------7 	end the find if cmd part ...
	end ---------------------------------------------------------------------------------------------------8 	end the find if cmd not nil part ...
end --------------------------------------------------------------------------------------------------------------9 	end the if main chat msg part ...
end -------------------------------------------------------------------------------------------------------------10	end the Data Arrivals function ...

I was looking here and here for help on this ...
Thanks to you alsom your post triggered a will to learn pattern matching the good way ;)

SMF spam blocked by CleanTalk