I've checked out Y-hub, and saw that Topic function..
Can anyone make a script like that?
Thank you
:rolleyes:
What does it do ? If u can tell us what it does, then someoen would write the script for u :)
-- [TopicBot] - v0.1
-- Written by bonki
--
-- ABOUT:
-- Allows you to add a topic to your hub(name) (not shown in hublists!)
--
-- AVAILABLE COMMANDS:
-- !tb.help: Guess.
-- !tb.settopic : Sets a new topic (OP).
-- !tb.rmtopic: Removes the current topic (OP).
--
-- OTHER FEATURES:
-- You may want to edit 'sHubnamePattern' to suits your needs.
-- This will be the final string for hubname + topic.
-- [hubname] will be replaced with your hub's name.
-- [topic] will be replaced with your hub's topic.
--
-- BUGS/LIMITATIONS:
-- If you change your hubname when a topic is set, you have to reset the topic
-- in order to change the displayed hubname to the new one.
--
-- CHANGELOG:
-- v0.1: General: Initial release
--
sName = "here ure nick";
sVer = "";
sAbout = "Allows you to add a topic to your hub."
sHubnamePattern = "[hubname] [topic: [topic]]"
sTopicFile = "TopicBot.topic";
sTopic = nil;
sHubname = "";
sCrLf = "\r\n";
-------------------------------------------------------------------------------
function Main()
bot = { sBotName = sName,
sBotVer = sVer,
sBotTag = "<++V:0.262,M:A,H:0/0/8,S:3>",
sBotDescr = "[topic]",
sBotEmail = "",
sBotSpeed = "DSL",
iBotShare = 199999999990 };
LoadTopic();
UpdateBotInfo();
SendBotInfo();
sHelpHeader = sCrLf..sCrLf.."TopicBot v"..bot.sBotVer.." "..sCrLf..sAbout..sCrLf;
sOpHelpOutput = sCrLf.."OP Commands:"..sCrLf..sCrLf;
sHelpOutput = sCrLf.."Commands:"..sCrLf..sCrLf;
tCommands = {
[ "!tb.help" ] = { CmdShowHelp, 0, nil, "\tDisplays this help message." },
[ "!tb.settopic" ] = { CmdSetTopic, 1, "", "Sets the topic to ." },
[ "!tb.rmtopic" ] = { CmdRemoveTopic, 1, nil, "Removes the current topic." },
};
for sCmd, tCmd in tCommands do
if(tCmd[2] == 1) then
if (tCmd[3]) then
sOpHelpOutput = sOpHelpOutput..sCmd.." "..tCmd[3].."\t\t"..tCmd[4]..sCrLf;
else
sOpHelpOutput = sOpHelpOutput..sCmd.."\t\t"..tCmd[4]..sCrLf;
end
hasOpCommands = 1;
else
if (tCmd[3]) then
sHelpOutput = sHelpOutput..sCmd.." "..tCmd[3].."\t"..tCmd[4]..sCrLf;
else
sHelpOutput = sHelpOutput..sCmd.."\t\t"..tCmd[4]..sCrLf;
end
end
end
frmHub:RegBot(bot.sBotName);
end
-------------------------------------------------------------------------------
function CmdShowHelp(curUser)
local sMsg = sHelpHeader;
if (curUser.bOperator and hasOpCommands) then
sMsg = sMsg..sOpHelpOutput;
end
sMsg = sMsg..sHelpOutput;
curUser:SendData(bot.sBotName, sMsg);
end
-------------------------------------------------------------------------------
function CmdSetTopic(curUser, args)
if (strlen(args) > 0) then
SetTopic(args, 1);
else
curUser:SendData(bot.sBotName, "Syntax error, see help.");
end
end
-------------------------------------------------------------------------------
function CmdRemoveTopic(curUser)
if (sTopic) then
sHubname = frmHub:GetHubName();
sTopic = nil;
remove(sTopicFile);
SendHubname();
UpdateBotInfo();
SendBotInfo();
SendToAll(bot.sBotName, "Hub topic removed!");
else
curUser:SendData(bot.sBotName, "There's currently no topic set anyway!");
end
end
-------------------------------------------------------------------------------
function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
if(cmd == nil) then
return 0; end
if (tCommands[cmd]) then
curUser:SendData(sData);
if (tCommands[cmd][2] == 0 or curUser.bOperator) then
tCommands[cmd][1](curUser, strlower(args));
else
curUser:SendData(bot.sBotName, "You do not have sufficient rights to run that command!");
end
return 1;
end
return 0;
end
-------------------------------------------------------------------------------
function NewUserConnected(curUser)
SendHubname();
SendBotInfo(curUser);
end
-------------------------------------------------------------------------------
OpConnected = NewUserConnected;
-------------------------------------------------------------------------------
function SaveTopic(curTopic)
flTopicFile = openfile(sTopicFile, "w");
if (flTopicFile) then
write(flTopicFile, curTopic);
closefile(flTopicFile);
end
end
-------------------------------------------------------------------------------
function LoadTopic()
flTopicFile = openfile(sTopicFile, "r");
if (flTopicFile) then
sTopic = read(flTopicFile);
closefile(flTopicFile);
SetTopic(sTopic, 1);
end
end
-------------------------------------------------------------------------------
function SetTopic(curTopic, bSave)
curTopic = gsub(curTopic, "%s+", " ");
curTopic = gsub(curTopic, "%c+", " ");
sTopic = curTopic;
local sHubString = gsub(sHubnamePattern, "%[topic%]", sTopic);
sHubString = gsub(sHubString, "%[hubname%]", frmHub:GetHubName());
sHubname = sHubString;
if (bSave) then
SaveTopic(curTopic);
end
UpdateBotInfo();
SendBotInfo();
SendHubname();
SendToAll(bot.sBotName, "Welcome to Music-Lovers-Sweden here we try to share "..curTopic);
end
-------------------------------------------------------------------------------
function SendHubname(curUser)
if (curUser) then
curUser:SendData("$HubName "..sHubname);
else
SendToAll("$HubName "..sHubname);
end
end
-------------------------------------------------------------------------------
function SendBotInfo(curUser)
if (curUser) then
curUser:SendData(sBotInfo);
else
SendToAll(sBotInfo);
end
end
-------------------------------------------------------------------------------
function UpdateBotInfo()
local sBotDescr = "";
if (sTopic) then
sBotDescr = gsub(bot.sBotDescr, "%[topic%]", sTopic);
else
sBotDescr = gsub(bot.sBotDescr, "%[topic%]", "No topic set.");
end
sBotInfo = "$MyINFO $ALL "..bot.sBotName.." "..sBotDescr..bot.sBotTag.."$ $"..bot.sBotSpeed..strchar(1).."$"..bot.sBotEmail.."$"..bot.iBotShare.."$";
end
-------------------------------------------------------------------------------
Thx Hypnos for that ;) I was looking for a script like this a long time..
Cya :)
u need a file more
TopicBot.topic
put that in script folder to
Question though, It says it will replace the hubname with the topic you set, Can't it be done like [Hubname] - [Topic]
yes
is first hubname then topic
sorry i used 40 gb as min before u can change to wot u like
u set topic games/movies or something like that and then ex here we try to share iso games
just as it say test and u see when u set topic just reconnect and read in top
it show in publiclist aswell :)
Hi!
I?m sorry but this is probably a very stupid question..
But you just posted a lot of text in here for that Topicbot...
My question is... How do i get that added to the server?
do i just put that in a txt file and go?
how do i make that topicbot.topic file so i can get in the hub??
shouldn?t it have some kind of .lua file or something?
I realy don?t know anything about this... and i would be realy glad if someone can tell me exactly how to get that script working in the hub...
Thanx!
//PiLeN
This way:
select the whole script totally:
from "-- [TopicBot] - v0.1.." to "-----"
copy
Go to PtokaX>Script editor>paste the script in the big window
(must be empty if there is a other script shown-> empty the window)
Hit the "check syntax" button (PtokaX will check if there are some errors in the script > if this is copy paste again > still a error ask help at this thread at Lua Forum)
Hit the "save" button and save the scipt with a name like "TopicBot" (must be saved in the script directory of PtokaX)
Hit the " restart scripts" button
If you want to change something in the script (like the name of the Bot) open the script file > change what you want to change > save script under the same name > restart scripts again.
[NL]MrBuitenhuizen
Restart scripts
setting a hub topic is also available in the next release of ptokax hubsoft!
-Troubadour-
Thank you so much!!
//PiLeN