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.

Bar Total Amount Tab

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Bar Total Amount Tab

Post by ComputerTech »

Hmm not exactly sure if i can explain what my idea is , but i'll try :roll:

so this idea is for my bar script and the part i am requesting is,
when a user types !beer it will do the usual putserv privmsg stuff

but the part i need to add is everytime a user types !beer it will add to a amount of say 20 per !beer command so i need a way to make it gather all of those 20's and make a total each time, almost like a bar tab , cheers in advanced all those who help me with this hehe :lol:

(I'll try and make something like above myself and post my code :D )
ComputerTech
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

If you plan to extend this to other drinks as well, I suggest having a look at dict and have all the drinks like:

Code: Select all

dict set drinks "beer" 20
dict set drinks "vodka" 50
dict set drinks "tea" 5
and can get it's price with something like:

Code: Select all

[dict get $drinks $drink]
for example after you make sure it exist, for example:

Code: Select all

if {[lsearch -nocase [dict keys $drinks] $drink] != -1} {
	puthelp "PRIVMSG $chan :Price for $drink is [dict get $drinks $drink]"
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

hmm i see but this is for prices i think , would this work in gathering like this

?beer thats 5

?beer thats 10

and so on

would dict work for that?

so every time a user types ?beer it will add 5 to the total amount Until the user types
?pay
ComputerTech
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

I think i found what i needed to use incr

http://suninet.the-demon.de/056.htm

seems to add digits to a variable, exactly what i need hehe

i'll go try it and if it works i'll post my code :roll:
ComputerTech
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

ComputerTech wrote: ...
i'll go try it and if it works i'll post my code
And if it doesn't work, post your code if you want. You might get some help and/or ideas. ;)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Post Reply