Recreational Illicits V.2

By Elbarto on May 02, 2011

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
}

Comments

Sign in to comment.
Elbarto   -  May 04, 2011

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 :)

 Respond  
Epic   -  May 04, 2011

lol both napa's and jethros styles are far more efficient but also confusing id assume for elbarto, but right, vars are alright for small things but in long run they suck

 Respond  
Jethro   -  May 03, 2011

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.

 Respond  
napa182   -  May 03, 2011

using global vars this way is a bad idea, unless you want to fill up ur var list.. You would be better off using either a txt file or hash.

 Respond  
Epic   -  May 03, 2011

hey on the reset, can just make it do

unset %toke [ $+ [ $nick ] ]

can do tht for them, didnt wanna give u a complex unset because idk if it would affect others lol :p

 Respond  
Epic   -  May 02, 2011

well thats way to do it :o

 Respond  
napa182   -  May 02, 2011

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)
  }
}
 Respond  
Epic   -  May 02, 2011

:p when i get a minute or 2 im msg u the stirkbin of a redone version explaining what each thing does if you'd like

but food comes first! sorry xd

 Respond  
Elbarto   -  May 02, 2011

btw Epic, i see the code you put in, idk where id put that or what it does, im sure it does what you say but idk how to use it......

 Respond  
Elbarto   -  May 02, 2011

lol well i just put a post in the forums for this one, asking the same thing basically

Thanks tho, if you realy wouldnt mind helping me, PM me and ill be glad to send over my email for IM'age or something.

 Respond  
Epic   -  May 02, 2011

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

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.