This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

BogusTrivia - only ops start/stop trivia

Support & discussion of released scripts, and announcements of new releases.
Post Reply
g
garlic641
Voice
Posts: 3
Joined: Sun Oct 04, 2015 11:29 am

BogusTrivia - only ops start/stop trivia

Post by garlic641 »

Hi,
I'm using BogusTrivia for my channel.
I want to set it so only channel operators can stop/start a game.

In t2-settings.tcl , so far I have:

Code: Select all

set t2(oflag) "o|o"   ;# flags to turn the game on ("" = everyone) #
set t2(sflag) ""      ;# flags to turn game off    ("" = same as on flags) #
What flag(s) do I need to set for the desired result?
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That is the correct flags settings to allow only channel and global ops to use the on/off commands.

BogusTrivia is an eggdrop script, and the script/bot expects you to add your ops to the internal eggdrop user list.

The script does not look at the channel to see if anyone has +o in the channel.

With a few simple script hacks, Bogus could be made to look at the channel status of a user that is trying to turn the script on/off.
If you think you can safely modify the script code, I will work up a hack to check for +o in the channel. Let me know if you're interested.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
g
garlic641
Voice
Posts: 3
Joined: Sun Oct 04, 2015 11:29 am

Post by garlic641 »

Thanks for your reply.

Right now, I can stop/start the trivia script even without being opped; but that's probably because the Eggdrop bot already recognizes me as the owner of the bot, right?

If so, how can I add friends to the 'op user list' of Eggdrop so they can also start/stop the trivia bot? Is it with the .adduser command? If so, that's probably too much control for just starting/stopping a trivia script.


SpiKe^^ wrote:That is the correct flags settings to allow only channel and global ops to use the on/off commands.

BogusTrivia is an eggdrop script, and the script/bot expects you to add your ops to the internal eggdrop user list.

The script does not look at the channel to see if anyone has +o in the channel.

With a few simple script hacks, Bogus could be made to look at the channel status of a user that is trying to turn the script on/off.
If you think you can safely modify the script code, I will work up a hack to check for +o in the channel. Let me know if you're interested.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

garlic641 wrote:Thanks for your reply.

Right now, I can stop/start the trivia script even without being opped; but that's probably because the Eggdrop bot already recognizes me as the owner of the bot, right?
Being owner of the bot includes many flags. One of them matches that which you have configured for the start/stop flags in the script.
Most likely, you have the o flag.
If so, how can I add friends to the 'op user list' of Eggdrop so they can also start/stop the trivia bot? Is it with the .adduser command? If so, that's probably too much control for just starting/stopping a trivia script.
.adduser is one way, yes. .
+user is the other, but then you must add the user's hostmask yourself.
.adduser will add it automatically (but you should still inspect it, to be sure it is not too broad.)

As for the side effect of adding too much other control:
You can make up your own flags, if you like. Just use UPPER case.
If you wish, you could then have a flag that does nothing else, other than what you configure for it, in BogusTrivia.

See:
http://www.egghelp.org/commands/index.htm

Some specific commands to see there:
http://www.egghelp.org/commands/core.htm#whois
Use this command to view your own account in bot, and see your current flags. Also, you can get a list of all the pre-configured user attribute flags in Eggdrop.

http://www.egghelp.org/commands/irc.htm#adduser
http://www.egghelp.org/commands/core.htm#chattr
http://www.egghelp.org/commands/core.htm#+user
http://www.egghelp.org/commands/core.htm#+host

http://www.egghelp.org/commands/core.htm#help
This one is VERY useful. You would do yourself a favor, to get the hang of using it. I use it all the time. :)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

For the commands to add your ops to the eggdrop internal user list, follow the links provided by willyw above.
That would make the script work as it is intended, starting/stopping for any user with an o flag in the user file.


If you would like to make the on/off commands available to only those that are currently opped (have +o) in the channel, that requires a little script editing...

1) In the t2-settings.tcl file, you would have to make the on/off commands trigger for everyone...

Code: Select all

set t2(oflag) ""   ;# flags to turn the game on ("" = everyone) #
set t2(sflag) ""   ;# flags to turn game off    ("" = same as on flags) #
2) Then you would have to make the script check if the user triggering the on/off command is opped in the channel or not.

In the t-2.tcl file, search for this string...

Code: Select all

proc TOnOff
On or about line 1854 you should find these 2 lines...

Code: Select all

proc TOnOff {nk uh hn ch tx {from 0} } {  global t2 tclr botnick nick
 if {![file exists $t2(sfpath)t2.settings]} {  set temp [TSetup $nk $uh $hn 1 1]
You will need to add a line between those 2 lines that will check if the user is opped in the channel, and not reply if they aren't.
Make the script read more like this...

Code: Select all

proc TOnOff {nk uh hn ch tx {from 0} } {  global t2 tclr botnick nick
 if {$from=="0" && ![isop $nk $ch]} {  return 0  }
 if {![file exists $t2(sfpath)t2.settings]} {  set temp [TSetup $nk $uh $hn 1 1]
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
g
garlic641
Voice
Posts: 3
Joined: Sun Oct 04, 2015 11:29 am

Post by garlic641 »

All answers were very helpful, thanks.

Also: thanks SpiKe^^ for the time and dedication you've put into BogusTrivia.
Post Reply