Poll.Bot.v.1.0.LUA5-TTB
 

News:

11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Poll.Bot.v.1.0.LUA5-TTB

Started by TTB, 11 July, 2006, 13:06:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TTB

Hi,

nErBoS created one in LUA4, and Jiten converted it into LUA5.
Here is a new bot  ;D  Hope you all gonna like it. You can download the attachment, and extract it in your scripts folder!


-- Finally a good pollbot ;-)
-- Created by TTB on 11 July 2006
-- For PtokaX 0.3.3.0 or higher
-- Special thanx to nErBoS and Jiten
----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
--------------------------------------------------------------------
--[[ 
There are many features on this bot. When a bot has been created, everyone only gets a PM. When ppl log into the hub, they will get a PM if they did not vote already. 
Just check it out... if you have special requests, post them. I always can see what I can do :-)

Your commands:

All users:
#pollhelp - Check the commands
#poll - View the current poll 
#poll <nr> - Vote when poll is active 
#oldpoll - List of all oldpolls 
#oldpoll <pollname> - View old poll 
Operators:
#polladd <name> <nr> <subj> - Create a new poll 
#pollclose - Close current poll, and add it to oldpolls 
#polldel - Delete current poll (it won't be added to oldpolls) 
#oldpolldel <pollname> - Delete oldpoll forever 

NOTE: All commands can be done in the main chat. Only the wizard and the #poll command can be done in PM to the bot.
]]--


Have fun with this!

Get it:
-> under this post
-> or here: http://ptxscriptdb.psycho-chihuahua.net/download.php?view.264

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Newer versions:

Version 1.2: http://forum.ptokax.org/index.php?topic=6138#msg63976
Version 1.3: http://forum.ptokax.org/index.php?topic=6138#msg64111
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

6Marilyn6Manson6

Where is link for download this bot? :S

TTB

Quote from: 6Marilyn6Manson6 on 11 July, 2006, 13:19:25
Where is link for download this bot? :S

Check my edited note...   ???   Crappy forum  :-\
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

6Marilyn6Manson6

I see link in Leun post not in TTB post :P

TTB

The file is now in the first post. Check it out  8)
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

6Marilyn6Manson6

Now I see it in first post... now is ok :D

TTB

Hi,

The file has been downloaded 12 times  ;D  Do you ppl like it? Any suggestions?
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

6Marilyn6Manson6

Quote from: TTB on 12 July, 2006, 15:15:02
Hi,

The file has been downloaded 12 times? ;D? Do you ppl like it? Any suggestions?

Now I see it, thanks :D

imb

Testing, looks great so far. It was what was needed for a long time, a more sophisticated poll bot. Thanks  ;D
Posted on: 25 July 2006, 23:50:31
[22:34] Syntax ...s\0.3.3.21.nt.db\scripts\Poll.Bot.v.1.1.LUA5-TTB.lua:273: attempt to perform arithmetic on field `?' (a nil value)


First error if it's any help, not sure what caused it.

TTB

On it... I had this error also. It was when I closed the poll. I don't know at this moment what the problem is. I have also noticed another bug. Soon I will release version 1.2.  ;D

Thanx for your report!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

HappyTheMan

I want to post my comment about that script because: THIS IS JUST THE BEST SCRIPT I HAVE EVER SEEN!!!! All is easy, handy, good looking. Even the code is beautiful to look at!! I tried many scripts and this is THE SCRIPT. Smart scripting by a smart guy, congratulations TBB!

TTB

Euh... the nickname is "TTB".  Thank you for your reply  ;D
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

[HE]Newbie

Nice script TTB, keep up the good work

function PollPM(curUser,data)
	local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd and (string.lower(cmd) == (prefix.."poll")) then
		local s,e,cmd,answer = string.find(data,"%b<>%s+(%S+)%s+(%d+)")
		if PollSettings["current"] == 2 then
			if answer then
				if PollVotes[curUser.sName] then
					curUser:SendPM(bot,"# You have already voted! You can't vote again. Type "..prefix.."poll (without a number) to check the statistics!")
				else
					answer = tonumber(answer)
					if answer > PollSettings["questions"] then
						curUser:SendPM(bot,"Error! Answer "..answer.." is not in my list!")
					else
						PollSettings["votes"][answer] = PollSettings["votes"][answer] + 1
						PollSettings["votes"]["n"] = PollSettings["votes"]["n"] + 1
						WriteFile(PollSettings, "PollSettings", pollsettings)
						PollVotes[curUser.sName] = 1
						WriteFile(PollVotes, "PollVotes", pollvotes)
						ShowPollWithResult(curUser,data)
						curUser:SendPM(bot,"# Thank you for voting "..answer..". You can check always the poll by entering "..prefix.."poll in PM to "..bot..". Please vote again by our next poll.")
						SendPmToNick(PollSettings["currentcreator"],bot,"# "..curUser.sName.." voted for answer : "..answer.."!")
					end
				end
			else
				if PollVotes[curUser.sName] then
					ShowPollWithResult(curUser,data)
				else
					ShowPollWithNoResult(curUser,data)
				end
			end
		else
			curUser:SendPM(bot,"# Sorry, there is no active poll... You can't vote at this moment!")
		end
	end
end


Ok maybe its cool when you see who answered what in the OpChat, so i (hope) changed the text : SendPmToNick(PollSettings["currentcreator"],bot,"# "..curUser.sName.." voted for answer : "..answer.."!") <-- Pretty easy xD, but probably some guys will like it

regards newbie
There will be 1 day, that i learn

nlgezel.hopto.org:411

TTB

Hmz... It is more that the creator knows, how much reply's he gets on his poll. And I do not agree with this:

QuoteSendPmToNick(PollSettings["currentcreator"],bot,"# "..curUser.sName.." voted for answer : "..answer.."!")

It should be anonymous! The respond was just a check. I accually shouldn't add this to the code!

Gr. TTB

TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

speedX

Is it possible to make a progress bar or graph for this poll script?
Thanking You,

speedX

TTB

Progress bar of graph? Damn... then you also need to set the max of votes I suppose. And a graph is a little overdone, don't you think?! It might be possible, but it is to much work for me to create something like this.

Greetz, TTB.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Herodes

Quote from: TTB on 23 October, 2006, 23:30:16
Progress bar of graph? Damn... then you also need to set the max of votes I suppose. And a graph is a little overdone, don't you think?! It might be possible, but it is to much work for me to create something like this.

Greetz, TTB.
TTB search for DoBars function in the forum, and also look how the polls system on the board works (it hasn't got max votes and it has bars ;).

TTB

Quote from: Herodes on 24 October, 2006, 07:36:45
TTB search for DoBars function in the forum, and also look how the polls system on the board works (it hasn't got max votes and it has bars ;).

I can always take a look @ it... but I don't promise anything to put it in this Poll bot. Herodes? Can you give me some link for this DoBars function? I can't find it at the board (searched @ "bars" and "DoBars").
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Herodes

Use this one TTB:
function DoBars( val, max, length )
	lenght = length or 10
	local ratio = (val / ( max/length) )
	return "["..string.rep("-", ratio).."?"..string.rep(" ", length-ratio).."]"
end


Ofcourse this is not tested but I suppose it works and it is meant to give you the way its supposed to work.

TTB

Thanx....  ;D  Let's see what I can do with this.
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Markitos

Oh it works alright! Great function Herodes.

speedX

Quote from: Markitos on 01 November, 2006, 14:12:10
Oh it works alright! Great function Herodes.

I donno y it didn work for me  :( , or I am still a noob  :-\
Thanking You,

speedX

Markitos

You gotta make adaptations
Code: lua
function DoBars( val, max, length )
	lenght = length or 10
	local ratio = (val / ( max/length) )
	return "["..string.rep("-", ratio).."?"..string.rep(" ", length-ratio).."]"
end

ChatArrival = function(user,data)
	local s,e,cmd = string.find(data,"%b<>%s%p(%w+)")
	if cmd == "x" then
		local length,max,val = 100,300,200
		return user:SendData("x",DoBars(val,max,length)),1
	end
end

Quote from: speedX on 01 November, 2006, 14:30:01
or I am still a noob  :-\
All of us were ;)

TTB

I'm bizzy with it, and have updated some little things... Soon v1.2 will be here. ;-)
Posted on: 01 November 2006, 16:12:50
Hi...

Here is v.1.2!!!
[Added] Graphical interface (bars)
[Fixed] Some little bugs

Have fun with this!!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

speedX

Thank you for this cool script TTB ;)
Thanking You,

speedX

SMF spam blocked by CleanTalk