PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: enema on 28 September, 2004, 19:38:49

Title: "Inteligent" add message
Post by: enema on 28 September, 2004, 19:38:49
Hi!

Im woundering if there is such a part of script or code that sends add message in chat only when somebody is acctualy chatting in main? I want this add message to appear only when there are several lines in chat fulled up. So this add message could appear like only once a day (if chat is unused) or even after every minute (if everybody types stuff all the time)
Title:
Post by: enema on 28 September, 2004, 19:40:37
forgot one thing:

Dont make this script for me, I want to make it myself!!!! Just give me part of the script or code (if it exist, lol :D)
Title:
Post by: Psycho_Chihuahua on 28 September, 2004, 19:50:27
well, i know this won't be much help (i'm also noob)
but my guess is that you would need 2 triggers for that.

1. trigger set at x amount of mainchat lines

2. trigger set at a certain interval


greetz
Title:
Post by: BoJlk on 28 September, 2004, 20:05:01
There's a GOOD script by Mutor the great  :D

--AdTimer 1.1
--
--by Mutor
--
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--
--
--User Settings-------------------------------------------------------------------------------------
bot = "HubAd" -- Name for bot
mins = 120 -- Interval [in minutes] between Ads
Hubaddy = "mutor.no-ip.com" -- Duh?
HubOwner = "Mutor" -- Duh?
Prefix = "!" -- Set Command Prefix
AdComm = "ad" -- Command to send Ad immediately
TZone = " -5 GMT [EST]" -- Time Zone hub resides in
HubMsg1 = "Here, you can put announcements" -- Additional notices/info to be sent with ad
HubMsg2 = "or other information or..." -- Additional notices/info to be sent with ad
HubMsg3 = "Nothing at all !" -- Additional notices/info to be sent with ad
--End User Settings----------------------------------------------------------------------------------

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

function DataArrival(user, data)
s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
if (cmd==Prefix..AdComm) and user.bOperator then
OnTimer()  
end
end

function OnTimer()
local tmp
tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n" -- add/remove tabs ' \t '  ...to center hub name
tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n"
tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n"
tmp = tmp.."\tHub Time: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\tRedirect To: \t"..frmHub:GetRedirectAddress().."\r\n"
tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
tmp = tmp.."\tRedirect All: \t"..RedirAll().."\r\n"
tmp = tmp.."\tRedirect Full: \t"..RedirFull().."\r\n"
tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n"
tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
tmp = tmp.."\tMasters Online: \t"..cProfile("Master").."\r\n"
tmp = tmp.."\tOps Online: \t"..cProfile("Operator").."\r\n"
tmp = tmp.."\tVips Online: \t"..cProfile("VIP").."\r\n"
tmp = tmp.."\tRegs Online: \t"..cProfile("REG").."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tTotal Online: \t"..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tNotice(s):\r\n"
tmp = tmp.."\t-- "..HubMsg1.."\r\n"
tmp = tmp.."\t-- "..HubMsg2.."\r\n"
tmp = tmp.."\t-- "..HubMsg3.."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
SendToAll(bot,tmp)
end

function RedirAll()
local rdstatusall = frmHub:GetRedirectAll()
local rastatus = ""
if rdstatusall == 1 then
rastatus = "on"
else
rastatus = "off"
end
return rastatus
end

function RedirFull()
local rdstatusfull = frmHub:GetRedirectFull()
local rfstatus = 0
if rdstatusfull == 1 then
rfstatus = "on"
else
rfstatus = "off"
end
return rfstatus
end

--// Profile Counter
function cProfile(what)
local disp = ""
local table,online,offline = GetUsersByProfile(what),0,0
for i, User in table do
if GetItemByName(User) then
online = online + 1
else
offline = offline + 1
end
end
disp = disp.."Online: "..online.."\tOffline: "..offline
return disp
end
Title:
Post by: enema on 28 September, 2004, 20:26:16
Thanks Bjojlk, but Im afraid robocop can do better than that (sorry Mutor :D )
Title:
Post by: enema on 28 September, 2004, 20:30:02
can you show me, how do those triggers look like, Psycho_Chihuahua? :D I guess I have to ask for one script to friend where those triggers are used a lot.... But he isnt quite awailable now... guess I should wait for nErBoS :D
Title:
Post by: enema on 28 September, 2004, 20:38:37
sorry for mixing up with your nick, BoJlk! It was an accident :-\

[code] Thanks Bjojlk, but Im afraid robocop can do better than that (sorry Mutor :D ) [code/]
Title:
Post by: Psycho_Chihuahua on 28 September, 2004, 20:42:41
Well the script BoJlk just posted is the one i'm trying to mod.

and stuck in the process as well lol so best bet is to wait for one o them lua geniuses round here to come along  :D
Title:
Post by: BoJlk on 28 September, 2004, 21:08:05
No offend taken enema

Might as well Call 4 Mutor  :D

Thou i appreciate you work none the less Psycho_Chihuahua
Title:
Post by: enema on 29 September, 2004, 18:17:44
cmon all the smart minds of the forum! reunite! Could You please give me this tiny sh*t so I could finish my first script ever???? PlZ!!
Title:
Post by: enema on 29 September, 2004, 19:20:04
wtf are you talking about??? What final grade?? stop scaring me!!!


ok... now lets have a look... it is gonna ask for a while, but I wanna do this...
Title:
Post by: enema on 29 September, 2004, 19:42:46
Im sorry, but it isint what im looking for. I need a code or trigger or.... whatever.... that sends add message or anything else in mainchat when certain number of lines ar posted in chat. How does chat historian help me?? At least give me a hint! Im a real newbie but at least im trying to learn from professionals....
Title:
Post by: enema on 29 September, 2004, 19:52:40
ok, maybe my english su*ks... i dont know...

this is what I have:

function OnTimer()
if MessageTimer == 1 then
randomtimer = random(2)
if randomtimer == 1 then
SendToAll(Bot,"YYYYYYYYY")

elseif randomtimer == 2 then

SendToAll(Bot,"XXXXX")

end
end

(uh, I hope i will get those "code" things right)

As you can see, it works on timer... but i dont need any timer! I just need a Trigger or something, that send this add in chat if chat is used!!!
Title:
Post by: enema on 01 October, 2004, 11:02:08
Ok, I admit, I cant do it.... can anyone make this script forme, please??? I tried everything, even changing deflood scripts... I just dont know how to make this one  :(
Title:
Post by: enema on 02 October, 2004, 14:45:06
grr... Im disapponted Myself... next time I will try better