PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: (!(Tys?kan)=) on 21 April, 2004, 17:01:07

Title: VoteBot with user's comment
Post by: (!(Tys?kan)=) on 21 April, 2004, 17:01:07
Hi! I'd like the VotePoll, where user's can(if they want) add his description to the choosed variant. And numbers of voteoption may be some.
Such as:
----------------
!createvote Question#Description(not necessarily)
!addoption Answer1
!addoption Answer2
!addoption Answer3
etc.
!endoption
VotePoll successfully created!
----------------
or
----------------
!createvote Question#Description(not necessarily)
!endoption
VotePoll successfully created!
---
And Bot added this poll with answers:
1. Yes
2. No
----------------

----------------
!poll
There is 5 votepoll's:
1. How can I'm washing up my car.
2. How teaching to fly?
etc.

!poll 1
Poll n. 1:
1. Answer1(10 user's voted)
|||
2. Answer2(0 user's voted)

3. Answer3(17 user's voted)
||||||

(max: |||||||||| in percent of all users, | = ~10%)
etc.
!votefor 1#Description(not necessarily)
Ok! You has voted for: 1. Answer1. Thanks you!
---------------

Who can trying to write this script?



--Ty--
Title:
Post by: nErBoS on 22 April, 2004, 02:13:51
Hi,

I could try, but will take a bit, i am having a lot of work this days.

Best regards, nErBoS
Title:
Post by: (!(Tys?kan)=) on 23 April, 2004, 11:04:34
Ok, it's good
Title:
Post by: acethecase on 23 April, 2004, 11:47:34
Aiight..
Good there mr TY, Im looking for the same script
would be great if some1 can make it!
Title:
Post by: nErBoS on 25 April, 2004, 19:43:57
Hi,

Hope it helps...

--Requested by (!(Tys?kan)=)
--Made by nErBoS

sBot = "Poll-Bot"

poll = {}
pollsv = "pollsv.dat"
ended = {}
endedsv = "ended.dat"

function Main()
frmHub:RegBot(sBot)
end

function OnExit()
if (readfrom(pollsv) ~= nil and poll[1] == nil) then
LoadFromFile(pollsv)
end
if (readfrom(endedsv) ~= nil and ended[1] == nil) then
LoadFromFile(endedsv)
end
SaveToFile(pollsv , poll , "poll")
SaveToFile(endedsv , ended , "ended")
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!createvote" and user.bOperator) then
local s,e,quest = strfind(data, "%b<>%s+%S+%s+(.*)")
if (quest == "") then
user:SendPM(sBot, "Syntax Error, !creatvote , you must write a question.")
else
AddPoll(quest)
user:SendPM(sBot, "The Poll is open.")
end
return 1
elseif (cmd == "!addoption" and user.bOperator) then
local s,e,opt = strfind(data, "%b<>%s+%S+%s+(.*)")
if (quest == "") then
user:SendPM(sBot, "Syntax Error, !addoption

Little change in request, !poll shows all polls and !seepoll shows the poll typed.
This will only work 100% in ptokax 0.3.3.0

Best regards, nErBoS
Title: hello all :)
Post by: kbeh273300 on 25 April, 2004, 20:32:45
i would like that a poll be sent to mainchat on a timer once every hour and if there are say 2 or 3 polls have them sent to main chat on a timer randomly.what do ya think?
Title:
Post by: nErBoS on 25 April, 2004, 23:08:03
Hi,

Yes could be made. Gone create 2 commands one to activate the timer in a choose poll and other to stop.
Tomorrow i will see that.

Best regards, nErBoS
Title:
Post by: krayzie_t17 on 27 December, 2004, 15:56:21
That files that are create 1.poll, 1.vot, can created in a folder like 'polls' ....please edit bot for me thanx 8) and add and that option on main chat timer random if 2 polls
And the command to delete polls that you want Master !



Thanx very much
Title:
Post by: krayzie_t17 on 28 December, 2004, 18:43:12
QuoteOriginally posted by nErBoS
Hi,

Yes could be made. Gone create 2 commands one to activate the timer in a choose poll and other to stop.
Tomorrow i will see that.

Best regards, nErBoS


PLease nErBoS finish this script  :D
Title:
Post by: nErBoS on 04 January, 2005, 01:28:57
Hi,

Check out the "Finished Script" section, you will find the last version of this script in the "(Yes and No) VotePoll" topic.

Best regards, nErBoS