Party Game Console

This is a party game console. It contains within a list of several game cartridges you and your friends can use to play party games with, including: Acrophile, Luser Larts, Vampire, Mafia and Bicycle elcyciB.

Author: Walker@M*U*S*H
Category: Games
Compatibility: CobraMUSH, PennMUSH.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Party Game Console

@create Party Game Console Parent
@lock/Basic Party Game Console Parent==me
@lset Party Game Console Parent/Basic=no_inherit
@lock/Use Party Game Console Parent=ISCOMMAND/1
@lset Party Game Console Parent/Use=!no_inherit
@set Party Game Console Parent = LINK_OK
@set Party Game Console Parent = !NO_COMMAND
&CARTNAME Party Game Console Parent=%b%b[ljust(left(ansi(g,name(%0)),18),20)]
&CMD.ALL Party Game Console Parent=$*:think strcat(setq(n,u(fun.getplayer,%#)),setq(r,%!),switch(v(state),ready,u(h.ready_cmd,%0),game,u(h.game_cmd,%0))) ; @break cor(not(strmatch(v(state),game)),not(strlen(u(fun.get,timer)))) ; @trig me/trig.timer
&COMMANDS Party Game Console Parent=join|quit|list games|peruse x|choose x|load|players
&COMMANDS.GAME Party Game Console Parent=end|save|players|kickstart|peruse x|list games
&COMMANDS.READY Party Game Console Parent=join|quit|list games|peruse x|choose x|load|players
&CREDITS Party Game Console Parent=Originally by Walker@M*U*S*H
@set Party Game Console Parent/CREDITS=no_command
&DESC.GAME Party Game Console Parent=The current game is: [u(cartname,v(cartridge))]%r%r[u(v(cartridge)/desc.game)]%r
&DESC.READY Party Game Console Parent=This is a party game console. It contains within a list of several game cartridges you and your friends can use to play party games with, with ease and fun.%r%rCommands in 'ready' mode:%r%b%b[ansi(h,players)] - List of players currently joined.%r%b%b[ansi(h,join)] and [ansi(h,quit)] - join and quit the party games.%r%b%b[ansi(h,use [name(me)])] - To get available commands during the game at any time.%r%b%b[ansi(h,list games)] - List the games available.%r%b%b[ansi(h,peruse <gamename>)] - More information and rules about <gamename>%r%b%b[ansi(h,choose <gamename>)] - Start playing with <gamename>%r%rCommands in 'game' mode:%r%b%b[ansi(h,players)] - List players, possibly with game status effects.%r%b%b[ansi(h,end)] - which ends the game and waits for another game to be chosen.%r
&DESCRIBE Party Game Console Parent=strcat(setq(r,%!),setq(n,u(fun.getplayer,%#)),switch(v(state),ready,u(desc.ready),u(desc.game)))
@set Party Game Console Parent/DESCRIBE=no_command visual prefixmatch public nearby
&FILTER.ISGAME Party Game Console Parent=strmatch(xget(%0,type),game cartridge)
&FUN.ADD_COMMAND Party Game Console Parent=if(strmatch(v(state),game),set(me,commands:[setunion(%0,v(commands)|[v(commands.game)],|)]))
&FUN.ALLOW_NONPLAYERS Party Game Console Parent=set(me,allow_nonplayers:%0)
&FUN.CHOOSE Party Game Console Parent=strcat(setq(0,u(h.findcart,%0)),switch(1,strmatch(%q0,#-2),u(fun.pemit,%#,Which game?),not(member(v(players),%#)),u(fun.pemit,%#,You aren't playing!),strmatch(%q0,#-1),u(fun.pemit,%#,I don't have that game.),not(u(%q0/fun.playable,words(v(players)))),u(fun.pemit,%#,That game is unplayable with the current number of players),u(fun.init_game,%q0)))
&FUN.DEL_COMMAND Party Game Console Parent=if(strmatch(v(state),game),set(me,commands:[setunion(setdiff(v(commands),%0,|),v(commands.game),|)]))
&FUN.EMIT Party Game Console Parent=emit([firstof(xget(v(cartridge),prefix),v(prefix))]> %0)
&FUN.END Party Game Console Parent=switch(0,member(v(players),%#),u(fun.pemit,%#,You are not playing.),strmatch(v(state),game),u(fun.pemit,%#,There is no game in progress),strcat(u(fun.emit,%N ends the game. How sad.),wipe(me/allow_nonplayers),wipe(firstof(v(mem_card),me)/play`*),set(me,commands:[v(commands.ready)]),wipe(me/cartridge),set(me,state:ready)))
&FUN.END_GAME Party Game Console Parent=strcat(u(fun.emit,The game is over.),wipe(firstof(v(mem_card),me)/play`*),wipe(me/allow_nonplayers),set(me,commands:[v(commands.ready)]),wipe(me/cartridge),set(me,state:ready))
&FUN.FINDPLAYER Party Game Console Parent=first(iter(sortby(sort.name,v(players)),if(strmatch(name(##),%0*),u(fun.getplayer,##)),%b,%b))
&FUN.GET Party Game Console Parent=if(strmatch(v(state),game),if(hasattr(setr(z,firstof(v(mem_card),me)),play),xget(%qz,play`%0))
&FUN.GETPLAYER Party Game Console Parent=match(v(players),%0)
&FUN.HASATTR Party Game Console Parent=if(strmatch(v(state),game),if(hasattr(setr(z,firstof(v(mem_card),me)),play),hasattr(%qz,play`%0))
&FUN.INIT_GAME Party Game Console Parent=strcat(set(me,commands:[v(commands.game)]),set(me,players:[shuffle(v(players))]),u(fun.emit,%N chooses the game: [u(cartname,%0)]),set(me,state:game),set(me,cartridge:%0),u(%0/fun.init,words(v(players)))
&FUN.JOIN Party Game Console Parent=switch(1,t(member(v(players),%#)),u(fun.pemit,%#,You are already joined up.),strcat(u(fun.emit,%N joins the party game),set(me,players:[setunion(v(players),%#)])))
&FUN.KICKSTART Party Game Console Parent=if(lt(v(semaphore),4),strcat(u(fun.set,timer,u(fun.get,timer.back)),u(fun.emit,%N tries to kickstart the party game)),u(fun.pemit,%#,The semaphore's too high))
&FUN.LATTR Party Game Console Parent=if(strmatch(v(state),game),if(hasattr(setr(z,firstof(v(mem_card),me)),play),edit(lattr(%qz/play`%0),PLAY`,))
&FUN.LIST_CARTS Party Game Console Parent=u(fun.pemit,%#,strcat(%r,if(setr(0,filter(filter.isgame,lcon(me))),Games on this console:%r[iter(%q0,u(cartname,##),%b,%r)]%r),if(setr(0,filter(filter.isgame,lcon(v(gamebox)))),Games in the game box:%r[iter(%q0,u(cartname,##),%b,%r)]%r)))
&FUN.PEMIT Party Game Console Parent=pemit(switch(1,isdbref(%0),%0,isnum(%0),elements(v(players),%0),%#),[firstof(xget(v(cartridge),prefix),v(prefix))]: %1)
&FUN.PERUSE Party Game Console Parent=strcat(setq(0,u(h.findcart,%0)),u(fun.pemit,%#,switch(%q0,#-2,Which game?,#-1,I don't have that game.,About [u(cartname,%q0)]%r%r[u(%q0/about)]%r
&FUN.PLAYERS Party Game Console Parent=[setq(r,%!)][if(not(words(v(players))),u(fun.pemit,%#,There are currently no players.),u(fun.pemit,%#,Players:%r[iter(sortby(sort.alpha,v(players)),%b%b[u(cartname,##)] [if(strmatch(v(state),game),u(v(cartridge)/fun.player_status,u(fun.getplayer,##)))],%b,%r)]))
&FUN.PNAME Party Game Console Parent=if(isdbref(%0),name(##),name(elements(v(players),%0)))
&FUN.QUIT Party Game Console Parent=switch(1,not(member(v(players),%#)),u(fun.pemit,%#,You aren't playing.),strcat(u(fun.emit,%N quits the party game),set(me,players:[setdiff(v(players),%#)])))
&FUN.SET Party Game Console Parent=if(strmatch(v(state),game),strcat(if(not(hasattr(setr(z,firstof(v(mem_card),me)),play)),set(%qz,play:Play tree)[set(%qz/play,no_command)]),set(%qz,play`%0[if(not(strmatch(%0,*:*)),:%1)])))
&FUN.SET_COMMANDS Party Game Console Parent=if(strmatch(v(state),game),set(me,commands:[setunion(%0,v(commands.game),|)]))
&FUN.SET_TIMER Party Game Console Parent=if(strmatch(v(state),game),u(fun.set,timer,%0 %1))
&FUN.WIPE Party Game Console Parent=if(strmatch(v(state),game),if(hasattr(setr(z,firstof(v(mem_card),me)),play),wipe(%qz/play`%0))
&GAMEBOX Party Game Console Parent=#10157
&H.FINDCART Party Game Console Parent=if(num(%0),num(%0),rnum(v(gamebox),%0))
&H.GAME_CMD Party Game Console Parent=switch(%0,end,u(fun.end),players,u(fun.players),replace *,u(fun.replace,rest(%0)),peruse *,u(fun.peruse,rest(%0)),list games,u(fun.list_carts),kickstart,u(fun.kickstart),join,u(fun.join),quit,u(fun.quit),save *,u(fun.save,rest(%0)),u(v(cartridge)/fun.command,%0))
&H.READY_CMD Party Game Console Parent=switch(%0,join,u(fun.join),quit,u(fun.quit),score,u(fun.reset),players,u(fun.players),peruse *,u(fun.peruse,rest(%0)),list games,u(fun.list_carts),choose *,u(fun.choose,rest(%0)),load *,u(fun.load,rest(%0)))
&ISCOMMAND Party Game Console Parent=strcat(null(setq(c,if(strmatch(%c,teach *),rest(%c),%c)),if(strmatch(%qc,with *=*),setq(c,after(%qc,=)))),cand(cor(strmatch(v(state),ready),cor(match(v(players),%#),v(allow_nonplayers),strmatch(%c,join),strmatch(%c,players))),switch(1,t(match(v(commands),%qc,|)),1,cand(gt(words(%qc),1),match(v(commands),first(%qc) x,|)),1,0)))
&MEM_CARD Party Game Console Parent=me
&PREFIX Party Game Console Parent=[Party Game]
@set Party Game Console Parent/PREFIX=no_command prefixmatch
&SORT.ALPHA Party Game Console Parent=comp(%0,%1)
&SORT.NAME Party Game Console Parent=comp(name(%0),name(%1))
&STATE Party Game Console Parent=ready
&TIMER.CALL Party Game Console Parent=fun.daytime
&TRIG.TIMER Party Game Console Parent=@wait me/[first(setr(0,u(fun.get,timer)))][set(me,timer.call:[rest(%q0)])][u(fun.set,timer,)][u(fun.set,timer.back,%q0)]={ think [setq(r,%!)][if(strmatch(v(state),game),u(v(cartridge)/[v(timer.call)])[u(fun.set,timer.back,)])] ; @break cor(not(strmatch(v(state),game)),not(strlen(u(fun.get,timer)))) ; @trig me/trig.timer }
&TYPE Party Game Console Parent=parent game
&UFAIL Party Game Console Parent=u(desc.ready)
@set Party Game Console Parent/UFAIL=no_command prefixmatch
&USE Party Game Console Parent=u(desc.ready)
@set Party Game Console Parent/USE=no_command prefixmatch