UPDATED
So i got mad thanks to Epic for helping me here.
The script has now been updated to hold a shotty Smoke Session....
Changes:
It no longer adds to your drink count with the !toke command(idk why i didnt see that before)
!session starts a smoke session
!join joins one(not realy needed yet but its there)
!start Starts and ends the session(still not quite there yet)
!reset Resets your personall toke count
!toke Takes a toke
!drink Gives a beer
!alltokes Shows all the tokes taken
!alldrinks shows all the drinks served
/resetall resets the whole thing, all variables are set back at 0
Again mad thanks to Epic for helping me here and sorry it took so long to update, kinda busy.
Will update more soon.
On 1:TEXT:*:#: {
if (!%fl) { inc -u3 %f
If (!toke isin $1) {
msg # 8 $nick is taking a personal toke. | msg # Tokes taken by $nick $+ : %ptoke [ $+ [ $nick ] ]
inc %ptoke [ $+ [ $nick ] ]
inc %toke 1
}
If (!alltokes isin $1) {
msg # 8Altogether tokes taken: %toke
}
If (!alldrinks isin $1) {
msg # 8Altogether drinks served: %drink
}
If (!drink isin $1) {
describe # 8Hands $nick a cold beer. | msg # 8Cold Beers served to $nick $+ : %pdrink [ $+ [ $nick ] ]
inc %drink 1
inc %pdrink [ $+ [ $nick ] ]
}
If (!session isin $1) && (%ses == off) {
msg # $nick would like to start a smokers session. Type !join to join the session
set %ses on
set %join on
}
elseif (!session isin $1) && (%ses == on) {
msg # session already in progress. type !join to join the session.
}
If (!start isin $1) && (%ses == on) {
msg # Session starting. | msg # Type !cheers for for your toke. | msg # Get Ready!!! | msg # !!3!! | msg # !!2!! | msg # !!1!! | msg # !!!!! | msg # Cheers!!!!!
set %ses off
.timer 1 5 set %join off | msg # Session Over!!
}
elseif (!start isin $1) && (%ses == off) {
msg # There is no session in progress. Type !session to start one.
}
if (!join isin $1) && (%ses == off) {
msg # Gotta be a session in progress to join one dumby.
}
elseif (!join isin $1) && (%ses == on) {
msg # $nick has joined this session
}
if (!reset isin $1) {
msg # personal toke count reset to 0.
set %ptoke [ $+ [ $nick ] ] 0
}
if (!cheers isin $1) && (%join == on) {
msg # Toke added.
inc %ptoke [ $+ [ $nick ] ] 1
inc %toke 1
}
elseif (!cheers isin $1) && (%join == off) {
msg # sorry $nick but the last session has already ended, i cannot add a toke to your count with !cheers without you being in a session, type !toke for a personal toke.
}
}
}
Alias resetall {
msg # All Tokes/Drinks counts have been reset at 0.
set %drink 0
set %pdrink [ $+ [ $nick ] ] 0
set %ptoke [ $+ [ $nick ] ] 0
set %toke 0
}
idk wut hash tables are...... so until i can get a chance to learn more about it i probably wont use it.
as far as confuseing, its not your style brah, lol its the code. im just a newb is all.
and ya i kinda forgot about the forum post, im going there now to check it out, post the updated script(this one) and ask more questions :)
As a matter of fact, Elbarto has asked for a suggestion to improve his unedited, original script to identify each individual who has triggered the script and counts their tokes and drinks at the forum. I thought it'd be best to have it posted again here under his snippet thread, just in case he's overlooked or forgotten:
on *:exit:td
on *:start:td
alias -l td {
var %td 1
while $gettok(toke drink,%td,32) {
var %v1 $v1
if $event = exit {
hsave -o %v1 %v1
}
else {
if $isfile(toke) && $isfile(drink) {
hmake %v1 100
hload %v1 %v1
}
}
inc %td
}
}
on $*:text:/^!(?i)(toke|drink)$/S:#:{
if !%p {
set -z %p 3
var %- $regml(1)
hinc -m %- $nick
set -u3 $+(%,%-) $iif(%- = toke,$nick is taking a personal toke. $&
Toke(s) taken altogether: $hget(%-,$nick),Hands $nick a Cold Beer. $&
Drink(s) served altogether: $hget(%-,$nick))
$replace(%-,toke,msg,drink,describe) # [ [ $+(%,%-) ] ]
}
}
This uses hash tables, which I believe it's a better, recommended method.
I have an uneasy feeling that my coding style has confused the heck outta Elbarto and made him speechless.
just an example of making it on one text event nothing more...
On $*:TEXT:/^!(toke|drink)$/Si:#: {
if (!%f) { inc -u3 %f
inc $+(%,$regml(1)) 1
$iif($regml(1) = toke,msg # $nick is taking a personal toke. Tokes taken,$&
describe # Hands $nick a Cold Beer. Drinks served) altogether: $($+(%,$regml(1)),2)
}
}
Looks like a good script for someone starting to learn, and for the storing what person did how many tokes, could use a
On 1:TEXT:*!toke*:#: {
inc %toke [ $+ [ $nick ] ]
msg # $nick is taking a personal toke. Tokes taken altogether: %toke [ $+ [ $nick ] ]
}
or an Ini File, if i had more time id help you out with a rewrite sometime :p sorry if that doesnt seem too clear