@@ This code create globals for a Cellphone, @@ with a way to ring someone, to put in micro- @@ phones on the phone and such, and to put @@ phones off or on. @create Cellphone Globals &LEFT Cellphone Globals=[mid(%0,0,%1)] &RIGHT Cellphone Globals=[mid(%0,sub(strlen(%0),%1),%1)] &RINGING Cellphone Globals=$+phone/ring *:&connect[get(me/connect[%#])] me=;&connect%# me=;@switch [gt(match(lwho(),[num(*%0)]),0)]=0,@pemit %#=I'm sorry but I'm afraid the person you are trying to call is not a connected player. Please type '+who' and choose a name from the list to call.,{@switch [gt(match(iter(lattr(me/phoneoff*),mid(##,8,strlen(##))),[num(%#)]),0)]=1,@pemit %#=It seems you have your mobile phone switched it off at this moment. Please use '+phone/on' first.,{@switch [gt(match(iter(lattr(me/phoneoff*),mid(##,8,strlen(##))),[num(*%0)]),0)]=1,@pemit %#=It seems %0 does not have a mobile phone or has switched it off at this moment.,{@switch [gt(match([setunion([iter(lattr(me/connect*),mid(##,7,strlen(##)))],[iter(lattr(me/connect*),get(me/##))])],[num(*%0)]),0)]=1,{@pemit %#=I'm sorry but %0 is allready in a phone talk. Only one talk can be done per time. %0 has gotten a message that you have tried to reach them and that the current talk has to be ended for you to take up contact again.;@pemit *%0=While you are talking on the phone [name(%#)] tries to reach you but you have to break off your current conversation with '+phone/hangup' to use the phone to contact %o.},{@pemit *%0=Your mobile phone is ringing and the number recognition says it must be %N if you know %o. You can answer the call with '+phone/accept' or decline it with '+phone/decline'.;@pemit %#=You try to call [name(*%0)] and the phone gives the waiting tone.;@oemit *%0=[name(*%0)]'s mobile phone starts ringing.;&connect[num(*%0)] me=%#}}}} &ACCEPTPHONE Cellphone Globals=$+phone/accept:@switch [gt(strlen(get(me/connect[%#])),0)]=0,@pemit %#=I'm sorry but you were not called so there is no call to answer.,{@oemit %#=%N takes the call.;@pemit [get(me/connect[%#])]=%N answers the call. You can now speak using '+phone '.;@pemit %#=You answer the call and can now speak using '+phone '.;&connect[get(me/connect[%#])] me=%#} &DECLINEPHONE Cellphone Globals=$+phone/decline:@switch [gt(strlen(get(me/connect[%#])),0)]=0,@pemit %#=I'm sorry but you were not called so there is no call to decline.,{@oemit %#=%N refuses the call.;@pemit [get(me/connect[%#])]=%N refuses the call and hangs up again.;@pemit %#=You have refused the call and hung up.;&connect%# me=} &HANGUP Cellphone Globals=$+phone/hangup:@switch [gt(strlen(get(me/connect[%#])),0)]=0,@pemit %#=I'm sorry but you were not called so there is no call to hang up on..,{@pemit [get(me/connect%#)]=%N hangs up the phone.;@pemit %#=You hang up the phone.;@wait 1=&connect[get(me/connect[%#])] me=;@wait 1=&connect[%#] me=} &SETOFF Cellphone Globals=$+phone/off:&connect[get(me/connect[%#])] me=;&connect%# me=;@pemit %#=You have switched off your mobile phone or make sure you have never bought one.;&phoneoff[%#] me=1 &SETON Cellphone Globals=$+phone/on:@pemit %#=You switch your mobile phone back on.;&phoneoff[%#] me= &SETSHARE Cellphone Globals=$+phone/share:&phoneshare[%#] me=1;@pemit %#=You switch the speakers of your mobile phone on so others can hear the conversation.;@oemit %#=%N switches the speakers of the phone on so you can listen in. &UNSHARE Cellphone Globals=$+phone/unshare:&phoneshare[%#] me=;@pemit %#=You switch the speakers of your mobile phone off so others cannot hear the conversation.;@oemit %#=%N switches the speakers of the phone off so you can listen in no longer. &TALKPHONE Cellphone Globals=$+phone *:@switch [gt(strlen(get(me/connect[%#])),0)]=0,@pemit %#=I'm sorry but you were not called so there is no call to answer.,{@oemit %#=[switch([u(me/left,%0,1)],:,On the phone %N%b,;,On the phone %N,",On the phone %N says ",',On the phone %N says ",//,On the phone ,On the phone %N says "[u(me/left,%0,1)])][u(me/right,%0,[sub(strlen(%0),1)])];@pemit [get(me/connect[%#])]=[switch([u(me/left,%0,1)],:,On the phone %N%b,;,On the phone %N,",On the phone %N says ",',On the phone %N says ",//,On the phone ,On the phone %N says "[u(me/left,%0,1)])][u(me/right,%0,[sub(strlen(%0),1)])];@pemit %#=[switch([u(me/left,%0,1)],:,On the phone the other side can hear that %N%b,;,On the phone the other side can hear that %N,",On the phone you say ",',On the phone you say ",//,On the phone ,On the phone you say "[u(me/left,%0,1)])][u(me/right,%0,[sub(strlen(%0),1)])];@switch [get(me/phoneshare[get(me/connect[%#])])]=1,@oemit [get(me/connect[%#])]=[switch([u(me/left,%0,1)],:,On the phonespeakers %N%b,;,On the phonespeakers %N,",On the phonespeakers %N says ",',On the phonespeakers %N says ",//,On the phonespeakers ,On the phonespeakers %N says"[u(me/left,%0,1)])][u(me/right,%0,[sub(strlen(%0),1)])],@dolist [setdiff(lcon(loc([get(me/connect[%#])])),get(me/connect[%#]))]={@switch [gt(add(hasflag(##,hss)),get(##/meriacute-hearing),get(##/isspying)),0)]=1,@pemit ##=[switch([u(me/left,%0,1)],:,On the phone you overhear that %N%b,;,On the phone you overhear that %N,",On the phone you overhear %N saying ",',On the phone you overhear %N saying ",//,On the phone you overhear ,On the phone you overhear %N saying "[u(me/left,%0,1)])][u(me/right,%0,[sub(strlen(%0),1)])]}} &helpphone Cellphone Globals=$+phone/help:@pemit %#={This%bis%bthe%bglobal%bcommand%bfor%bcellphone%buse.%bThere%bare%bseveral%bcommands%bfor%bsettings%band%bseveral%bcommands%bfor%busing%bthe%bphone.%r%r+phone/ring%b%b%b%b%b%b%bcalls%bsomeone%r+phone/accept%b%b%b%b%b%b%b%b%b%b%baccepts%bthe%bgiven%bcall.%r+phone/decline%b%b%b%b%b%b%b%b%b%bdeclines%bthat%bcall%r+phone%b%b%b%b%b%b%b%b%b%b%b%btalks%bon%bthe%bphone%r%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bYou%bcan%buse%b:;%blike%bin%bposes%band%b'"%bfor%bspeaking%r%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bor%bjust%bhave%bthe%bphone%bspeak%bfor%byou.%b%r%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b//%bwill%bmake%ban%bemit%bthrough%bthe%bphone.%r+phone/hangup%b%b%b%b%b%b%b%b%b%b%bfinishes%byour%bconversation.%r%rCommands%bfor%bother%bphonesettings:%r+phone/off%b%b%b%b%b%bSets%byour%bmobile%bphone%boff.%r+phone/on%b%b%b%b%b%b%bSwitches%byour%bphone%bback%bon%r+phone/share%b%b%b%bPuts%bthe%bspeakers%bof%byour%bmobile%bphone%bfor%bothers%bto%bhear.%r+phone/unshare%b%bswitches%bthe%bspeakers%bof%byour%bphone%bon%bso%bonly%byou%bcan%bhear.} @set Cellphone Globals=INHERIT