Author Topic: .Poll.Bot - TTB  (Read 35282 times)

0 Members and 1 Guest are viewing this topic.

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
.Poll.Bot - TTB
« on: 12 June, 2008, 15:27:30 »
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\
« Last Edit: 27 February, 2009, 20:20:38 by 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

PtokaX forum

.Poll.Bot - TTB
« on: 12 June, 2008, 15:27:30 »

Offline Grey777

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #1 on: 14 June, 2008, 09:43:20 »
thank you, but i can't run them, it say what not fond tables (ptoka 0.4.1.0)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #2 on: 14 June, 2008, 15:13:21 »
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

Offline Grey777

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #3 on: 14 June, 2008, 16:40:22 »
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

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: .Poll.Bot - TTB
« Reply #4 on: 14 June, 2008, 16:43:44 »
Have you extracted all files?
Everything could have been anything else and it would have just as much meaning.

Offline T.C.M

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #5 on: 14 June, 2008, 19:15:46 »
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  :)

Offline Grey777

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #6 on: 14 June, 2008, 20:09:31 »
yes, all four files from archive in folder with scripts. Tried write direct ways - too most

Offline Grey777

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #7 on: 15 June, 2008, 03:57:47 »
 remains only wait, Madman I faith in you  :)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #8 on: 16 June, 2008, 11:20:57 »
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

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #9 on: 17 June, 2008, 07:44:21 »
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

Offline miago

  • Fulll Member
  • ****
  • Posts: 57
  • Karma: +2/-0
  • QueenBiatch, SuperBiatch or PsychoBiatch :)
Re: .Poll.Bot - TTB
« Reply #10 on: 26 June, 2008, 08:20:51 »
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 ;)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #11 on: 26 June, 2008, 19:10:38 »
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

Offline miago

  • Fulll Member
  • ****
  • Posts: 57
  • Karma: +2/-0
  • QueenBiatch, SuperBiatch or PsychoBiatch :)
Re: .Poll.Bot - TTB
« Reply #12 on: 27 June, 2008, 07:58:45 »
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 ;)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #13 on: 29 June, 2008, 21:16:37 »
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

Offline miago

  • Fulll Member
  • ****
  • Posts: 57
  • Karma: +2/-0
  • QueenBiatch, SuperBiatch or PsychoBiatch :)
Re: .Poll.Bot - TTB
« Reply #14 on: 30 June, 2008, 08:30:21 »
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
« Last Edit: 30 June, 2008, 08:36:49 by miago »
Being a biatch aint easy ;)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #15 on: 30 June, 2008, 13:29:13 »
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

Offline miago

  • Fulll Member
  • ****
  • Posts: 57
  • Karma: +2/-0
  • QueenBiatch, SuperBiatch or PsychoBiatch :)
Re: .Poll.Bot - TTB
« Reply #16 on: 30 June, 2008, 14:37:00 »
Ok....gonna try find out whats wrong...

Thx again for the job done on the script :D

Cheers  // miago
Being a biatch aint easy ;)

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #17 on: 01 July, 2008, 10:19:49 »
no problem
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Offline Grey777

  • Junior Member
  • **
  • Posts: 11
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #18 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)
« Last Edit: 03 July, 2008, 16:50:15 by Grey777 »

Offline dimetrius

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #19 on: 11 July, 2008, 12:34:24 »
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
« Last Edit: 11 July, 2008, 13:45:56 by dimetrius »

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #20 on: 12 July, 2008, 00:27:23 »
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

Offline dimetrius

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #21 on: 12 July, 2008, 11:06:41 »
It seems I have decided this error...
Code: [Select]
---------------------------------------------------------------------------------------------------
-- 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


Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #22 on: 12 July, 2008, 11:52:53 »
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

Offline dimetrius

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: .Poll.Bot - TTB
« Reply #23 on: 12 July, 2008, 15:33:39 »
Discovered another mistake! Users can choose to answer several times! If you can answer several options!

Offline Madman

  • Scripter
  • Emperor
  • ******
  • Posts: 1 316
  • Karma: +75/-1
Re: .Poll.Bot - TTB
« Reply #24 on: 16 July, 2008, 00:52:27 »
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

PtokaX forum

Re: .Poll.Bot - TTB
« Reply #24 on: 16 July, 2008, 00:52:27 »