mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2017
Posts: 5
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Apr 2017
Posts: 5
I have the following script and I want to tailor it for male/female aka +'s vs non+'s in the channel. So, basically girls will get a + and be the "Spinner". I want the bottle to land on anyone that does NOT have a +. Can anyone help me? Thank you.

#spin_1 on
on *:load: {
.disable #spin_2
unset %spin.*
}
on *:text:!status:*:{
.notice $nick Spin the bottle is $group(#spin_2)
if $group(#spin_2) == on {
if $numtok(%spin.list,32) == 0 { .notice $nick There are no players }
elseif $numtok(%spin.list,32) == 1 { .notice $nick The only player is %spin.list }
else {
set %spin.nick $iif($istok(%spin.list,%spin.nick,32),%spin.nick,%spin.last)
set %spin.nick $iif($istok(%spin.list,%spin.nick,32),%spin.nick,$gettok(%spin.list,1,32))
.notice $nick It is %spin.nick $+ 's turn to spin
}
}
}

on *:text:!add *:#:{
if !$nick(#,$nick,r) {
.write spin.txt $2-
.notice $nick Thankyou $nick - $2- has been added to the list
}
}
on *:text:!spinthebottle &:#:{
if !$nick(#,$nick,r) {
if ($2 == on) && ($group(#spin_2) == on) { .notice # Spin The Bottle is On }
elseif ($2 == on) {
.enable #spin_2
describe # Spin the Bottle has started
}
elseif ($2 == off) && ($group(#spin_2) == off) { .notice $nick Spin The Bottle is not running }
elseif ($2 == off) {
.disable #spin_2
unset %spin.*
describe # Spin the Bottle has ended
}
}
else .notice $nick Sorry, but you don't have the authority to use that command
}

on *:part:#:{
if $istok(%spin.list,$nick,32) {
set %spin.list $remtok(%spin.list,$nick,1,32)
describe # Current players are %spin.list
if $nick == %spin.nick { unset %spin.nick }
if $nick == %spin.last { unset %spin.last }
}
}
on *:quit:{
if $istok(%spin.list,$nick,32) { set %spin.list $remtok(%spin.list,$nick,1,32) }
if $nick == %spin.nick { unset %spin.nick }
if $nick == %spin.last { unset %spin.last }
}
on *:kick:#:{
if $istok(%spin.list,$knick,32) {
set %spin.list $remtok(%spin.list,$knick,1,32)
describe # Current players are %spin.list
if $knick == %spin.nick { unset %spin.nick }
if $knick == %spin.last { unset %spin.last }
}
}
on *:text:!player*:#:{
if $group(#spin_2) == on { .notice $nick Current players are %spin.list }
else .notice $nick Spin The Bottle is not running
}
#spin_1 end

#spin_2 on
on *:text:!play:#:{
if $istok(%spin.list,$nick,32) { .msg $nick You are already playing }
else {
set %spin.list $addtok(%spin.list,$nick,32)
describe # Current players are %spin.list
}
}

on *:text:!watch:#:{
if $istok(%spin.list,$nick,32) {
set %spin.list $remtok(%spin.list,$nick,1,32)
describe # Current players are %spin.list
if $nick == %spin.nick { unset %spin.nick }
if $nick == %spin.last { unset %spin.last }
}
else .msg $nick You aren't playing
}

on *:text:!spin:#:{
if $numtok(%spin.list,32) == 1 { describe # Sorry $nick $+ $chr(44) but it appears you are the only player }
elseif $nick != %spin.nick { .notice $nick Sorry $nick it's not your turn }
else {
set %spin.last $nick
while %spin.nick == $nick { set %spin.nick $gettok(%spin.list,$rand(1,$numtok(%spin.list,32)),32) }
describe # Watches as the bottle spins around and around
describe # Watches as the bottle slows down, and stops pointing at %spin.nick
while %old == %new { set %new $rand(1,$lines(spin.txt)) }
set %old %new
describe # Now, %spin.last you must $read(spin.txt,%new) %spin.nick
}
}
#spin_2 end

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
What you want is probably these totals:

//echo -a no-status= $nick($chan,0,r) status-of-any-kind: $nick($chan,0,a,r)

depending on who the spinner is. The total of the above numbers is the total count in your nicklist. In addition to checking for no-players in the other list, you might want to check for the boring 1-player-in-other-list. If not wanting the same nick be chosen from that group twice in a row, the best way is to get another random $nick($chan,$rand(1,$nick($chan,0,r))).nick if it's a repeat, for which you'd need at least 2 nicks in the other group to avoid an infinite loop.

Joined: Apr 2017
Posts: 5
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Apr 2017
Posts: 5
The first part of what you said makes sense, re: no status. The other part, it makes sense but you're scripting abilities are way over my head. I wish I was that smart.

Where do I put the "echo" script that you just wrote?

Last edited by nerdycritter; 24/11/19 07:50 PM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I wasn't expecting you to put the echo there, I was just using that to show the numbers it returns, if there's a channel with 7 voices and 23 not-status, those identifiers would return the 7 and 23, which you could use to choose someone like $rand(1,7) or $rand(1,23). I thought you were wanting a push in the right direction, not for someone to rewrite your script.

Are you making the assumption that 100% of the people in the channel are playing? Because if so, that looks like it removed 90% of what the script is doing, because that way there's no need to build a list by !add'ing people then keeping track when people /part or /quit. If you want it to exclude the nick running the script, that adds a little bit of complexity, but if you want to support widescale opt-out, then it might simply have the script tweaked so that when people want to add themselves to the list, it would use the identifiers in my echo command to identify which team to add them to.


Link Copied to Clipboard