PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: bastya_elvtars on 15 September, 2004, 02:18:58

Title: Policy Of Truth
Post by: bastya_elvtars on 15 September, 2004, 02:18:58
Just a little fun script to stuff up mainchat lines - it is real fun
-- PolicyOfTruth by Herodes and bastya_elvtars (the rock n' roll doctor)
-- puts some addition after mainchat lines
-- questions are omitted, also commands starting with !


chance=6 -- the bigger the number is, the less the chance is that users text will be changed

mergetext={ -- up2u to add anything u like, it comes after users text and a space
"- just kidding! :P",
"- i am a fool and telling lies...",
"- dont u believe what i say!",
" or not,...",
" i am being a dork",
" i dont really mean this ..",
}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
if not strfind(data,"%b<>%s+!.*") and not strfind(data,"%?$") then
--strsub(data,strlen(data),strlen(data)~="?") then
local a=random(chance)
if a==1 then
SendToAll(data.." "..mergetext[random(getn(mergetext))]) return 1
else
SendToAll(data) return 1
end
end
end
end
Title:
Post by: Herodes on 15 September, 2004, 02:26:56
"Take my word for it ... , or not .."  lol
Title:
Post by: bastya_elvtars on 17 September, 2004, 21:19:29
Quote[21:17] <[Telia]Styx> +rules  i am being a dork

:D :D :D
Title:
Post by: Herodes on 17 September, 2004, 23:42:17
Lol bast
I like this script as nothing in the world :D

An update so that  +rules i am a dork doesnt happen ;)

-- PolicyOfTruth by Herodes and bastya_elvtars (the rock n' roll doctor)
-- puts some addition after mainchat lines
-- questions are omitted, also commands starting with the prefixes in tPref ;)
tPrefs = { "!", ".", "?", "+", "@", "#"}

chance=6 -- the bigger the number is, the less the chance is that users text will be changed

mergetext={ -- up2u to add anything u like, it comes after users text and a space
" just kidding! :P",
" i am a fool and telling lies...",
" dont u believe what i say!",
" or not,...",
" i am being a dork",
" i dont really mean this ..",
}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
for i,v in tPrefs do
if not strfind(data,"%b<>%s+"..v..".*") and not strfind(data,"%?$") then
local a=random(chance)
if a==1 then
SendToAll(data.." "..mergetext[random(getn(mergetext))]) return 1
else
SendToAll(data) return 1
end
end
end
end
end
Title:
Post by: bastya_elvtars on 17 September, 2004, 23:49:59
OK, Herodes, I win...
-- PolicyOfTruth by Herodes and bastya_elvtars (the rock n' roll doctor)
-- puts some addition after mainchat lines
-- questions are omitted, also commands starting with the prefixes in tPref ;)
----------- v 0.2
-- added prefixed command protection by Herodes
-- added question teasing by bastya_elvtars
tPrefs = { "!", ".", "?", "+", "@", "#"}


chance=6 -- the bigger the number is, the less the chance is that users text will be changed


mergetext={ -- up2u to add anything u like, it comes after users text and a space
"- just kidding! :P",
"- i am a fool and telling lies...",
"- dont u believe what i say!",
" or not,...",
" i am being a dork",
" i dont really mean this ..",
}

mergeq={ -- text after questions
"i know im a n00b, but what2do...",
"lol, i ask such a simple thing.",
"damn, i am bothering you again",
"i know the answer, but mainchat looked so empty.",
"hehe i think ppl in here are holding encyclopaedias in their hands",
}

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
for i,v in tPrefs do
if not strfind(data,"%b<>%s+"..i..".*") and not strfind(data,"%?$") then
local a=random(chance)
if a==1 then
SendToAll(data.." "..mergetext[random(getn(mergetext))]) return 1
else
SendToAll(data) return 1
end
elseif not strfind(data,"%b<>%s+"..i..".*") and strfind(data,"%?$") then
local a=random(chance)
if a==1 then
SendToAll(data.." "..mergeq[random(getn(mergeq))]) return 1
else
SendToAll(data) return 1
end
end
end
end
end
Title:
Post by: TiMeTrAVelleR on 18 September, 2004, 09:49:14
This last version  block  commands  i use  in hub  

 8)

lol  they  both  do  
Title:
Post by: BottledHate on 18 September, 2004, 10:08:32
QuoteOriginally posted by T?M??r?V?ll?R
This last version  block  commands  i use  in hub  

 8)

lol  they  both  do  


looks like it is because it processes all data regardless
of weather it uses it or not... not positive, but removing
 the two:
else
SendToAll(data) return 1

should stop it from processing ALL chat therefore
making other commands not get to the other bots'
dataarrival. (i mean.. if it isn't going to use the data, let
it pass on its way.)
^^^^
don't quote me on this, i just came up with that looking at the thing...

another option.. add a "_" (underscore) to the begging of the script
 name, so it loads last in pto, making its' dataarrival get
 stuff after all the others have had their way with it.
^^^^
don't quote me on that either, it's REALLY late, and i've
 been partying :D

-BH
Title:
Post by: TiMeTrAVelleR on 18 September, 2004, 10:21:16
else
               SendToAll(data) return 1

removed  that  seems  to work   thanks

have a good sleep  :D
Title:
Post by: TiMeTrAVelleR on 18 September, 2004, 12:54:48
seemed  to work   but not animore  shame   quite funny  ;(