Jump to content

Help with infobot chat script


Taquito

Recommended Posts

Hi, this is chat infobot I own

-- wiadomosci 
local messages = { 
  
                     
                    "Check out our forum -  
  
#fbaf17", 
  
                                        "Type #ff5000/nos nfs #ffff00for NFS  
  
Nos, or #ff5000/nos normal #ffff00for Normal NOS", 
  
                } 
local r,g,b = 255,255,0  -- default color; #ffff00 
local stime = 210  -- time in seconds 
  
setTimer( 
    function() 
        local msg = messages[math.random(1,#messages)] 
        outputChatBox( msg, getRootElement(), r, g, b, true ) 
    end, 
    stime*1000,0 
) 
  
  

This is how it works, it shows messages randomly

ftrzshs.png

How do I make it so it works like this?

JzOrfNe.png

Edited by Guest
Link to comment
  • Moderators

I think he wants to show the messages in sequence and not randomly.

-- wiadomosci 
local current = 1 
local messages = { 
    "Check out our forum -#fbaf17", 
    "Type #ff5000/nos nfs #ffff00for NFS Nos, or #ff5000/nos normal #ffff00for Normal NOS",  
} 
local r,g,b = 255,255,0  -- kolor domyslny; #ffff00 
local stime = 10  -- czas w sekundach 
  
setTimer( 
    function() 
        if current > #messages then 
            current = 1 
        end 
        local msg = messages[current] 
        outputChatBox( msg, getRootElement(), r, g, b, true ) 
        current = current + 1 
    end, 
    stime*1000,0 
) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...