PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: DorianG on 07 February, 2004, 17:43:19

Title: Spot Random Time
Post by: DorianG on 07 February, 2004, 17:43:19
This Bot send each 30 minutes (that you can set) a Spot.
You can write yours spots in txt file and the Bot send the Spot's message .. Random..


BotName = "???[Bot]TimeSpot???"      --//Here you can set the name of the Bot

Minuti = 30   --//Set time in minutes

Time = Minuti*60000   --//Time in minutes * milliseconds (don't touch)

function Main()
        frmHub:RegBot(BotName)
        SetTimer(Time)
        StartTimer()
end

function ReadLine()
        while 1 do
                local line = read()
                if (line == nil) then
                        break
                else
                        SendToAll(BotName, line)
                end
        end
        readfrom()
end

--//If you want spotting more file "txt", add a new function for exemple:
--//      function Spot4()
--//              readfrom("Spot/Spot4.txt")
--//              ReadLine()
--//      end

function Spot1()
        readfrom("Spot/Spot1.txt")
        ReadLine()
end

function Spot2()
        readfrom("Spot/Spot2.txt")
        ReadLine()
end

function Spot3()
        readfrom("Spot/Spot3.txt")
        ReadLine()
end

--//Then you add a new msgspot and in random set the number of messages that the Bot must send in mainchat
--//for exemple:
--//elseif (msgspot == 4) then
--//        Spot4()
--//end
--//remember that random must be setting in ---> random(4)

function MsgSpot()
        local msgspot = random(3)
        if (msgspot == 1) then
                Spot1()
        elseif (msgspot == 2) then
                Spot2()
        elseif (msgspot == 3) then
                Spot3()
        end
end

function OnTimer()
        MsgSpot()
end
Title:
Post by: gOOfus on 11 February, 2004, 21:13:34
Not sure how to make this work. Where does the text go? Do I make a folder in the scripts folder called Spot and put separate text files in it called Spot1 Spot2 etc.? Or do I insert the text directly into the LUA somewhere?
Title:
Post by: DorianG on 12 February, 2004, 11:35:04
You copy my code To Ptokax, Sassion Script then you Save it. Then Create a Directory and nominate it Spot.
In this directory you save the txt files and called it Spot1 ecc..
Now you insert the file lua and the directory Spot in the Directory Script that you find in the Ptokax Directory. :D
if you have others problems  send me a message here.
Se sei italiano puoi postare i tuoi problemi nel mio forum
Berlusca & Pierfido Revolution (http://www.forumfree.net/?c=16268)
Title:
Post by: kazi on 20 October, 2004, 00:21:27
Hi  i took the profiles.dat file out and placed it in the scripts folder.

still i get to see this message:  Error missing profiles, Install the provided profiles.dat that can be found in folder scripts/profiles!

What I do wrong?

thnx
Title:
Post by: Psycho_Chihuahua on 20 October, 2004, 00:38:38
try placing it in "scripts/profiles/"
Title:
Post by: kazi on 20 October, 2004, 00:43:45
seems to work thanx

now somehow users got this message???

[00:38:24] Your nick should start with one of the following tags:
[00:38:24] Change it and you are welcome back.
[00:38:24] Disconnects...

How can i turn this check off?