.Poll.Bot - TTB
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
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 - TTB

Started by Madman, 12 June, 2008, 15:27:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

Quick Convert of TTB's Poll Bot.
Meaning i used the Serach and Replace function in my editor.
It dosent give any errors at startup, so i guess it works ;p

It's attached here, and can also be found on my site under API 2 > Singel Scripts


--[[-- !IMPORTANT!
The new layout makes the pollvotes table invalid.
So BEFORE upgrade to 1.4, finsih your current running poll,
or all users will be able to vote again!
--]]--

v 2.0 supports Multi lang, and has the default path set to scripts\poll\ insted of just scripts\
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Grey777

thank you, but i can't run them, it say what not fond tables (ptoka 0.4.1.0)

Madman

Huh? Syntax errors please...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Grey777

with standard adjustment: ... 0.4.1.0\scripts\Poll.Bot.v.1.3.LUA5.1-TTB.lua:76: pollvotes.tbl for [BOT]Poll not found

bastya_elvtars

Have you extracted all files?
Everything could have been anything else and it would have just as much meaning.

T.C.M

are all files included?

[18:59] Syntax ...UB\devhub\dev1\scripts\Poll.Bot.v.1.3.LUA5.1-TTB.lua:76: pollsettings.tbl for [BOT]Poll not found

created empty file...

typing #pollhelp gives:

[20080614 - 19:02:03] <[BOT]Poll> ALERT!! I feel sick...: ...UB\devhub\dev1\scripts\Poll.Bot.v.1.3.LUA5.1-TTB.lua:161: attempt to call method 'SendData' (a nil value)
[20080614 - 19:02:03] <Daywalker> #pollhelp

replaced line 161 with: Core.SendToUser(curUser,"<"..bot.."> "..MainInfo)

#pollhelp fixed

after typing #poll this comes up:

[19:00] No syntax errors in script file Poll.Bot.v.1.3.LUA5.1-TTB.lua
[19:00] Script started.
[19:00] Syntax ...UB\devhub\dev1\scripts\Poll.Bot.v.1.3.LUA5.1-TTB.lua:94: attempt to index global 'PollSettings' (a nil value)

dunno if settings are preset or not..end of journal  :)

Grey777

yes, all four files from archive in folder with scripts. Tried write direct ways - too most

Grey777

 remains only wait, Madman I faith in you  :)

Madman

Will check later.. was busy in the weekend.. and will be today to, i should have some time over tomorrow
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Madman

fixed the 161 line bug.
Added the settings file to package.

The .prj that was in first realse was a misstake, is not for script.
It's a project file for my editor.
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

miago

Good morning =)

Had some trouble with RC, it didnt show, so I changed each line with user.sNick to curUser.sNick and then it worked. But only for master, reg doesnt get the RC.

When master tries to create poll, it asks for pollname, nr of answers and pollsubject, then it stops and shows the line in MC without giving any chance to put in the two answer options. And no errmsg in MC or ptokax.
<-[Admin]> #polladd Test 1 2 Do you like this?

If reg or master tries to write #poll in MC this errmsg appear: <-Poll-> ALERT!! I feel sick...: Poll.Bot.v.1.3.LUA5.1-TTB.lua:334: bad argument count to 'SendPmToUser' (3 expected, got 2)

Line 334 is this:          Core.SendPmToUser(curUser,"<"..bot.."> Sorry, there is no active poll... You can't vote at this moment!")

Nice to see the script come alive :D
Regards
miago
Being a biatch aint easy ;)

Madman

Everything found and fixed.

Should be completly bug free now ;p
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

miago

Nice work :)

Found one strange thing ... when choosing to see who has voted, the line "pollcreator" gets the current user nick, not the real pollcreator.

Reguser sees this:
[2008-06-27-07:55:00] <[BOT]Poll>
**************************************************
   POLL Votes
**************************************************
Pollcreator = test5
Pollname = test2
Uservotes: 1

The creator sees this:
[2008-06-27-07:55:17] <[BOT]Poll>
**************************************************
   POLL Votes
**************************************************
Pollcreator = -[ADMIN]-
Pollname = test2
Uservotes: 1

Cheers
miago
Being a biatch aint easy ;)

Madman

found it, e version uploaded
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

miago

#14
Nice...only thing Ive got now is that when I as a master wants to see who has voted, the info shows up in pm from bot, but in main chat this is shown:

<Hubbot> *** Error: You are not allowed to use this command!

when a reg user does the same he gets info in pm from bot and nothing is shown in main.

I havent change any profiles in ptokax.

Otherwise it works like a clock now :D
cheers
miago
Being a biatch aint easy ;)

Madman

That text is not from this script...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

miago

Ok....gonna try find out whats wrong...

Thx again for the job done on the script :D

Cheers  // miago
Being a biatch aint easy ;)

Madman

We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Grey777

#18
thanks!! interactive scripts this is cool  8)
script works! but oldpolls not saved
error: Poll.Bot.v.1.3e.LUA5.1.lua:438: bad argument #3 to 'SendPmToUser' (string expected, got nil)

dimetrius

#19
Quote from: Grey777 on 01 July, 2008, 20:14:31
thanks!! interactive scripts this is cool  8)
script works! but oldpolls not saved
error: Poll.Bot.v.1.3e.LUA5.1.lua:438: bad argument #3 to 'SendPmToUser' (string expected, got nil)
+1

Madman

oldpolls was saved, but was incorrectly saved in PtokaX root folder.
i fixed it in f version.

but don't know about the line 438 error... there is no SendPmToUser there...
if appers again, please report line, and what you where doing.
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

dimetrius

It seems I have decided this error...
---------------------------------------------------------------------------------------------------
-- Show an old Poll
---------------------------------------------------------------------------------------------------
function OldPoll(curUser,data)
	local _,_,_,namepoll = string.find(data,"^%b<>%s+(%S+)%s+(%S+)")
	if namepoll == nil then
		oTmp = ""
		iets = nil
		for a,b in pairs(OldPolls) do
			if iets then
				iets = iets..", "..a
			else
				iets = a
			end
		end
		if iets == nil then
			oTmp = "There are no old polls!"
			else
			oTmp = "Type: "..prefix.."oldpoll <pollname>. Here are the oldpolls:\r\n->["..iets.."]<-"
			Core.SendToUser(curUser,"<"..bot.."> "..oTmp)
		end		
	else
		if OldPolls[namepoll] then
			ooTmp = "\r\n"..string.rep("*",50).."\r\nOLD POLL: "..OldPolls[namepoll]["subject"].."\r\n"..string.rep("*",50).."\r\n\r\n"
			local c = tonumber(OldPolls[namepoll]["votes"]["n"])
			for a,b in pairs(OldPolls[namepoll]["active"]) do
				local bar = DoBars(string.format("%.0f",(100/c)*OldPolls[namepoll]["votes"][a]),100,lengthbar)
				ooTmp = ooTmp..a..". "..OldPolls[namepoll]["votes"][a].." vote(s)\t"..bar.." ("..string.format( "%.2f",(100/c)*OldPolls[namepoll]["votes"][a]).."%) vote(s)  "..b.."\r\n"
			end
			ooTmp = ooTmp.."\r\nTotal votes: "..c.." (100.00%)\r\n"..string.rep("*",50).."\r\nPoll created by: "..OldPolls[namepoll]["currentcreator"].."\r\nPoll created on: "..OldPolls[namepoll]["date"].."\r\nPoll closed at: "..OldPolls[namepoll]["close"].."\r\n"..string.rep("*",50)
		else
			ooTmp = "Sorry, the old poll  '"..namepoll.."'  does not excist! Type "..prefix.."oldpoll for all older polls!"
		end
			Core.SendPmToUser(curUser,bot,ooTmp)
		end
	oTmp = nil
	ooTmp = nil
	iets = nil
	return true
end



Madman

Yup... my bad...
Code moved around a little, should avoid that error now.
g version is uploaded.

I'll be at a friend, so bugs wont't be fixed untill maybe monday.. or sunday...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

dimetrius

Discovered another mistake! Users can choose to answer several times! If you can answer several options!

Madman

Since i only converted this script, please be a bit more specific, i.e what commands user used and in what order and so...
Don't understand the problem... might be due to lack of sleep tho...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk