topic changer
 

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

topic changer

Started by abyss, 20 December, 2004, 23:05:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

abyss

hoi have somebody a script for change the topic auto,
i seek a script they change the topic auto every 5 min and where i can put in 10 different topics.

hoi ik zoek een script die de topic verandert automatisch in door mij opgeven topic iedere 5 min ik dacht aan bv 10 verschillende topics wie weet wat

abyss :D

Herodes

sry it is late I havent tested at all ... if some one wants to make some input or this isnt what you want pls post further ...

--- Topico by Herodes 
--- changes/ the topics .. every x minutes ...

bot_name="Topico"
refresh = 10 -- time in minutes that the Hub's topic will be refreshed/changed ...
tTopics = {
	[0] = "First Topic",
	[1] = "Second Topic",
	[2] = "Third Topic",
	}

---do not edit ..
cur_pointer = 0

function Main()
	SetTimer(refresh*60000)
	StartTimer()
end

function OnTimer()
	Sendtopic()
	Next()
end

function Next()
	if cur_pointer == getn(tTopics) then  cur_pointer = 0
	else  cur_pointer = cur_pointer + 1 end
end

function Sendtopic()
	SendToAll("$HubName "..frmHub:GetHubName().." - "..tTopics[cur_pointer])
	SentToAll(bot_name, "The hub's topic changed to "..tTopics[cur_pointer])
end

function DataArrival(user, data)
	if (user.iProfile == 2) and (strsub(data, 1,1) == "<") then
		data = strsub(data, 1, strlen(data)-1)
		s,e,cmd,args = strfind(data, "$b<>%s+(%S+)%s*(%S*)")
		if cmd == "!newtopic" then
			if args and strlen(args) > 0 then 
				tTopic[getn(tTopic)+1] = args
				user:SendData(bot_name, " Added new temporary topic : "..args)
			else 
				user:SendData(bot_name, "Syntax Error! Use: !newtopic ")
			end
		elseif cmd == "!nextopic" then
			Next()
			Sendtopic()
		end
	end
end

Madman

Great script =)
2 probs tho...
This line need  to be change
SentToAll(bot_name, "The hub's topic changed to "..tTopics[cur_pointer])
to this...
SendToAll(bot_name, "The hub's topic changed to : "..tTopics[cur_pointer])
Just a small spelling error ;)

And the commands, i cant get to work at all
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

kepp

Bored..
--- Topico by Herodes 
--- changes the topic .. every x minutes ...
--- Modified by kepp a little

-- Bot Name
bot_name="Topico"

-- time in minutes that the Hub's topic will be refreshed/changed
refresh = 10

-- Set pattern, etc : sPattern = " -- [ ", will show, Hubname -- [ Topic
sPattern = " -- [ ";

SendTopicChange = 0

-- Set Topics
tTopics = {
	[0] = "First Topic",
	[1] = "Second Topic",
	[2] = "Third Topic",
}

---------------------------------------------------------------------------------
-- Restricted Area ;)
---------------------------------------------------------------------------------
cur_pointer = 0

function Main()
	SetTimer(refresh*60000)
	StartTimer()
end

function OnTimer()
	Sendtopic()
	ShiftTopic()
end

function DataArrival(user,data)
   if (strsub(data,1,1) == "<") then
      data = strsub(data,1,-2)
      local s,e,cmd = strfind(data,"^%b<>%s+(%S+)")
      if (strsub(cmd,1,1) == "!") then
         if (cmd == "!newtopic") then
            if (user.bOperator) then
               s,e,arg = strfind(data,"^%b<>%s+%S+%s+(.+)")
               if arg and strlen(arg) > 2 then
                  tinsert(tTopics,arg)
                  user:SendData(bot_name,"Temp topic was sucessfully added to temp list!")
                  return 1
               else
                  user:SendData(bot_name,"Please enter a topic!")
                  return 1
               end
            end
         end
      end
   end
end

function Sendtopic()
   local sTopic = tTopics[cur_pointer]
   if (SendTopicChange == 1) then
      SendToAll(bot_name,"The hubs topic were automatically changed to : "..sTopic)
   end
   SendToAll("$HubName "..frmHub:GetHubName()..sPattern..sTopic.."|")
end

function ShiftTopic()
   if (cur_pointer == getn(tTopics)) then cur_pointer = 0 end
   cur_pointer = cur_pointer + 1;
end
Guarding    

Madman

#4
So.. I feelt like scripting a little =)
--- Topico by Herodes 
--- changes the topic .. every x minutes ...
--- Modified by kepp a little
--- Madman also messed with the script

-- Bot Name
bot_name = "Topico"

-- time in minutes that the Hub's topic will be refreshed/changed
refresh = 10

-- Set pattern, etc : sPattern = " -- [ ", will show, Hubname -- [ Topic
-- if also sPatternInv = " ]", will show Hubname -- [ Topic ]
sPattern = " -- [ ";
sPatternInv = " ]";

-- Set to 1 if you want to send sPattern's
SendPattern = 1

-- Set to 1 if you want everybody to know that the topic was changed
SendTopicChange = 1

-- Set Topics
tTopics = {
	[0] = "First Topic",
	[1] = "Second Topic",
	[2] = "Third Topic",
}

---------------------------------------------------------------------------------
-- Restricted Area ;)
---------------------------------------------------------------------------------
cur_pointer = 0

function Main()
	SetTimer(refresh*60000)
	StartTimer()
end

function OnTimer()
	Sendtopic()
	ShiftTopic()
end

function DataArrival(user,data)
	if (strsub(data,1,1) == "<") then
	data = strsub(data,1,-2)
		local s,e,cmd = strfind(data,"^%b<>%s+(%S+)")
		if (strsub(cmd,1,1) == "!") then
			if (cmd == "!newtopic") then
				if (user.bOperator) then
					s,e,arg = strfind(data,"^%b<>%s+%S+%s+(.+)")
					if arg and strlen(arg) > 2 then
						tinsert(tTopics,arg)
						user:SendData(bot_name,"Temp topic was sucessfully added to temp list!")
						return 1
					else
						user:SendData(bot_name,"Please enter a topic!")
						return 1
					end
				end
			end
		end
	end
end

function Sendtopic()
	local sTopic = tTopics[cur_pointer]
	if SendPattern == 1 then
		if (SendTopicChange == 1) then
			SendToAll(bot_name,"The hubs topic were automatically changed to: "..sPattern..sTopic..sPatternInv)
		end
	SendToAll("$HubName "..frmHub:GetHubName().." - "..sPattern..sTopic..sPatternInv.."|")
	elseif SendPattern == 0 then
		if (SendTopicChange == 1) then
			SendToAll(bot_name,"The hubs topic were automatically changed to: "..sTopic)
		end
	SendToAll("$HubName "..frmHub:GetHubName().." - "..sTopic.."|")
	end
end

function ShiftTopic()
	if (cur_pointer == getn(tTopics)) then cur_pointer = 0 end
	cur_pointer = cur_pointer + 1;
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

kepp

#5
Nice work madman!!

--- changes the topic .. every x minutes ...
--- Modified by kepp a little
--- Madman also messed with the script
--- Now gets uploaded to Public Hub List aswell ( kepp )
--- Added commands to stop / start the cycle ( kepp )
--- Changed the Pattern

-- Bot Name
bot_name = "Topico"

-- Set your hubname here
sHubname = "Sweden[Music-Heaven]"

-- time in minutes that the Hub's topic will be refreshed/changed
refresh = 10

-- Set pattern, [TOPIC] represent the topic :)
sPattern = " -- [ [TOPIC] ] --";

-- Set to 1 if you want to send sPattern
SendPattern = 1

-- Set to 1 if you want everybody to know that the topic was changed
SendTopicChange = 1

-- Automatically start topic cycle when scripts starts / restarts
AutoStart = 1

-- Set Topics
tTopics = {
   [0] = "First Topic",
   [1] = "Second Topic",
   [2] = "Third Topic",
}

---------------------------------------------------------------------------------
-- Restricted Area ;)
---------------------------------------------------------------------------------
cur_pointer = 0

function Main()
   if (AutoStart == 1) then
      SetTimer(refresh*60000)
      StartTimer()
   end
   frmHub:SetHubName(sHubname)
   SendToAll("$HubName "..sHubname.."|")
end

function OnTimer()
   Sendtopic()
   ShiftTopic()
end

function DataArrival(user,data)
   if (strsub(data,1,1) == "<") then
      data = strsub(data,1,-2)
      local s,e,cmd = strfind(data,"^%b<>%s+(%S+)")
      if (strsub(cmd,1,1) == "!") then
         if (cmd == "!newtopic") then
            if (user.bOperator) then
               s,e,arg = strfind(data,"^%b<>%s+%S+%s+(.+)")
               if arg and strlen(arg) > 2 then
                  tinsert(tTopics,arg)
                  user:SendData(bot_name,"Temp topic was sucessfully added to temp list!")
                  return 1
               else
                  user:SendData(bot_name,"Please enter a topic!")
                  return 1
               end
            end
         elseif (cmd == "!stopcycle") then
            if (user.bOperator) then
               StopTimer()
               SendToAll("$HubName "..sHubname.."|")
               frmHub:SetHubName(sHubname)
               user:SendData(bot_name,"The topic cycle has now stoped and hubname is back to default!")
               return 1
            end
         elseif (cmd == "!startcycle") then
            if (user.bOperator) then
               SetTimer(refresh*60000)
               StartTimer()
               user:SendData(bot_name,"The topic cycle is running!")
               return 1
            end
         end
      end
   end
end

function Sendtopic()
   if (SendPattern == 1) then
      sTopic = gsub(sPattern,"%[TOPIC]",tTopics[cur_pointer])
      SendToAll("$HubName "..sHubname..sTopic.."|")
      frmHub:SetHubName(sHubname..sTopic.."|")
      if (SendTopicChange == 1) then
         SendToAll(bot_name,"The hubs topic were automatically changed to: "..sTopic)
      end
   elseif (SendPattern == 0) then
      sTopic = tTopics[cur_pointer]
      SendToAll("$HubName "..frmHub:GetHubName().." - "..sTopic.."|")
      frmHub:SetHubName(sHubname.." - "..sTopic.."|")
      if (SendTopicChange == 1) then
         SendToAll(bot_name,"The hubs topic were automatically changed to: "..sTopic)
      end
   end
end

function ShiftTopic()
   if (cur_pointer == getn(tTopics)) then cur_pointer = 0 end
   cur_pointer = cur_pointer + 1;
end

Keep going :)
Guarding    

abyss

k thank to all for this script  :]  :]  :]

abyss

hy gives this  error

Syntax error: function arguments expected;
  last token read: `=' at line 13 in file

i can not find the error  X(

abyss

kepp

#8
--- Topico by Herodes 
--- changes the topic .. every x minutes ...
--- Modified by kepp a little
--- Madman also messed with the script
--- Now gets uploaded to Public Hub List aswell ( kepp )
--- Added commands to stop / start the cycle ( kepp )
--- Changed the Pattern

-- Bot Name
bot_name = "Topico"

-- Set your hubname here
sHubname = "Sweden[Music-Heaven]"

-- time in minutes that the Hub's topic will be refreshed/changed
refresh = 10

-- Set pattern, [TOPIC] represent the topic :)
sPattern = " -- [ [TOPIC] ] --"

-- Set to 1 if you want to send sPattern
SendPattern = 1

-- Set to 1 if you want everybody to know that the topic was changed
SendTopicChange = 1

-- Automatically start topic cycle when scripts starts / restarts
AutoStart = 1

-- Set Topics
tTopics = {
   [0] = "First Topic",
   [1] = "Second Topic",
   [2] = "Third Topic",
}

---------------------------------------------------------------------------------
-- Restricted Area ;)
---------------------------------------------------------------------------------
cur_pointer = 0

function Main()
   if (AutoStart == 1) then
      SetTimer(refresh*60000)
      StartTimer()
   end
   frmHub:SetHubName(sHubname)
   SendToAll("$HubName "..sHubname.."|")
end

function OnTimer()
   Sendtopic()
   ShiftTopic()
end

function DataArrival(user,data)
   if (strsub(data,1,1) == "<") then
      data = strsub(data,1,-2)
      local s,e,cmd = strfind(data,"^%b<>%s+(%S+)")
      if (strsub(cmd,1,1) == "!") then
         if (cmd == "!newtopic") then
            if (user.bOperator) then
               s,e,arg = strfind(data,"^%b<>%s+%S+%s+(.+)")
               if arg and strlen(arg) > 2 then
                  tinsert(tTopics,arg)
                  user:SendData(bot_name,"Temp topic was sucessfully added to temp list!")
                  return 1
               else
                  user:SendData(bot_name,"Please enter a topic!")
                  return 1
               end
            end
         elseif (cmd == "!stopcycle") then
            if (user.bOperator) then
               StopTimer()
               SendToAll("$HubName "..sHubname.."|")
               frmHub:SetHubName(sHubname)
               user:SendData(bot_name,"The topic cycle has now stoped and hubname is back to default!")
               return 1
            end
         elseif (cmd == "!startcycle") then
            if (user.bOperator) then
               SetTimer(refresh*60000)
               StartTimer()
               user:SendData(bot_name,"The topic cycle is running!")
               return 1
            end
         end
      end
   end
end

function Sendtopic()
   if (SendPattern == 1) then
      sTopic = gsub(sPattern,"%[TOPIC]",tTopics[cur_pointer])
      SendToAll("$HubName "..sHubname..sTopic.."|")
      frmHub:SetHubName(sHubname..sTopic)
      if (SendTopicChange == 1) then
         SendToAll(bot_name,"The hubs topic were automatically changed to: "..sTopic)
      end
   elseif (SendPattern == 0) then
      sTopic = tTopics[cur_pointer]
      SendToAll("$HubName "..frmHub:GetHubName().." - "..sTopic.."|")
      frmHub:SetHubName(sHubname.." - "..sTopic)
      if (SendTopicChange == 1) then
         SendToAll(bot_name,"The hubs topic were automatically changed to: "..sTopic)
      end
   end
end

function ShiftTopic()
   if (cur_pointer == getn(tTopics)) then cur_pointer = 0 end
   cur_pointer = cur_pointer + 1;
end

The error you descrive must be in another script you are using.. But hey, i found another problem and is fixed!
Guarding    

SMF spam blocked by CleanTalk