@program nphone.muf 1 10000 d i ( NetPhone software v1.0 (C) 2003 Alynna Trypnotk, Daravon Inc. License: SCO UNIX Closed Source License - You Take, We Litigate This version for use on SC:HotE or SC:BI only. All rights reserved, do not port or modify without my permission. Nuku Valente only is assumed to have permission. ) $include $lib/rp $include $lib/alynna lvar param $iflib $lib/pokedex $def moneyprop "yen" $else $def moneyprop "gil" $endif $def basicaction "+phonever/2.02;+phone;+dial;+redial;+answer;+hangup;+phone/on;+phone/off;+phone/features;+phone/dir;+411;-" $def rstrcut over strlen swap - strcut $def ph.name prog "_ph/name" getprop $def ph.desc prog "_ph/desc" getprop $def ph.price prog "_ph/price" getprop $def ph.on "ph.on" getstat $def ph.num "ph.num" getstatstr $def ph.enabled "ph.active" getstat $def ph.features "ph.features" getstat $def ph.dir "ph.dir" getstat $def }tell }cat "Phone" pretty tellme $def }otell }cat "Phone" pretty tellhere $def phformat intostr { swap 7 rstrcut swap pop 3 strcut "-" swap }cat $def MONEYEXCEPT #7385 : ph.basicactioncheck trig name "+dial" instr if trig location me @ setlink trig location thing? if trig name basicaction stringcmp if trig basicaction setname { "Basic phone action updated." }tell trig location "_/de" "{eval:{list:_phoneimg,this}}" setprop trig location "_phoneimg" prog "_phoneimg" array_get_proplist array_put_proplist trig location "mynum" trig location ph.num setprop then then then ; : ph.relist var listing trig location var! phone { "Your phone has the phone number " phone @ ph.num "." }tell { "Do you want keep your number unlisted? If so, enter UNLISTED, or else enter the name for your listing. Adding your title and/or occupation is a good idea, for search purposes. @Q will abort now without spending 10 eGil." }tell read dup "UNLISTED" smatch not if listing ! else pop then listing @ if phone @ "ph.dir" listing @ setstat { "Listed you in the directory." }tell else phone @ "ph.dir" 0 setstat { "Removed you from the directory." }tell then me @ moneyprop over over getstat 10 - setstat ; : ph.feature?[ dbref:phone str:feature -- int:installed ] phone @ ph.features feature @ instr ; : findphone[ str:phnum -- dbref:phone ] var phones #-1 "*" "T" find_array "@rp/ph.num" phnum @ array_filter_prop phones ! phones @ array_count case 0 = when #-1 end ( I'm sorry, but your call cannot be completed as dialed. Please check the number and dial again. This is a recording. ) 1 = when phones @ array_vals pop end ( Yo, yo pick up the phone! Hello? WASSSUP!! ) 1 > when #-2 end ( WTF? How'd two or more phones get the same phone number?! ) endcase ; : ph.msg[ int:msgnum2 -- str:msg ] msgnum2 @ case 127 = when "The number dialed is the same as this phones number, the attempt to call yourself fails." end 200 = when "The call is connected. (OOC: Use - to talk, +hangup to end the call.)" end 210 = when "The remote party has answered the phone." end 220 = when "<<>>" end 300 = when "Attempting call..." end 301 = when "Connecting call..." end 401 = when "There is no call connected." end 402 = when "The remote phone is not on." end 403 = when "The remote phone is blocking your connection" end 404 = when "The call could not be completed as dialed. Please check the number and try again." end 500 = when "Communications failure." end 501 = when "You have hung up the phone, call disconnected." end 502 = when "The remote phone has been hung up, call disconnected." end 503 = when "The phone is busy." end 504 = when "The upgrade could not be completed as dialed. Please check the number and try again." end 550 = when "Feature not installed on this phone." end 551 = when "Feature not installed on the remote phone." end 559 = when "No such feature is available." end default "Serious protocol failure. Please notify Daravon of this software error and the error number given." end endcase ; : ph.disp[ int:msgnum -- str:msg ] me @ { "Message " msgnum @ ": " msgnum @ ph.msg }tell ; : ph.create var phnum var phone var listing me @ moneyexcept dbcmp not if me @ moneyprop getstat ph.price >= if me @ moneyprop over over getstat ph.price - setstat { ph.price " " moneyprop " was deducted from your account for your nifty " ph.name "..." }tell else { "You cannot afford a " ph.name ", the price is " ph.price "." }tell then then begin systime phnum ! { "Attempting to create phone with phone number " phnum @ phformat }tell #-1 "*" "T" find_array "@rp/ph.num" phnum @ phformat array_filter_prop array_count not if break then 1 sleep repeat preempt ( NOTHING ELSE until we make the phone ) me @ ph.name newobject phone ! foreground ( OK we can move again ) phone @ me @ setown phone @ ph.desc phnum @ phformat "$PHONE" subst setdesc phone @ "ph.num" phnum @ phformat setstat phone @ "ph.on" 1 setstat phone @ "ph.active" 1 setstat phone @ basicaction newexit prog setlink { "Your phone " phone @ ansi_unparseobj " was activated, given the phone number " phnum @ phformat ", and turned on." }tell { "Do you want keep your number unlisted for another 10 gil? If so, enter UNLISTED, else enter the name for your listing." }tell read dup "UNLISTED" smatch not if listing ! else pop then listing @ if phone @ "ph.dir" listing @ setstat { "Listed you in the directory." }tell else me @ moneyprop over over getstat 10 - setstat { "For 10 gil, you are going unlisted" }tell then phone @ "_/de" "{eval:{list:_phoneimg,this}}" setprop phone @ "_phoneimg" prog "_phoneimg" array_get_proplist array_put_proplist phone @ "mynum" phnum @ phformat setprop { "+phone/help for help." }tell ; : ph.dial var source var target var rings command @ "+redial" smatch if trig location "lastcalled" getprop tostr param ! then param @ not if { "Syntax: +dial " }tell exit then trig location source ! { "Attempting to contact " param @ "..." }tell param @ findphone target ! target @ #-1 dbcmp if 404 ph.disp exit then target @ #-2 dbcmp if 691 ph.disp exit then target @ "caller" getprop if 503 ph.disp exit then target @ source @ dbcmp if 127 ph.disp exit then target @ "caller" source @ ph.num setprop source @ "caller" target @ ph.num setprop source @ "lastcalled" target @ ph.num setprop target @ "lastcaller" source @ ph.num setprop target @ ph.on if background ( from here on out, were just waiting for a pickup ) source @ "ring" 1 setprop target @ "ring" 1 setprop 0 rings ! begin 220 ph.disp ( <> ) target @ location player? if target @ location location #-1 { target @ name " on " target @ location " rings..." }cat ansi_notify_except else target @ location #-1 { target @ name " at " target @ location " rings..." }cat ansi_notify_except then 10 sleep source @ "talkingto" getprop if break then target @ "talkingto" getprop if break then source @ "ring" getprop not if break then target @ "ring" getprop not if break then rings ++ rings @ 12 > if break then repeat else 402 ph.disp then source @ "talkingto" getprop not if target @ ph.features tostr "VOICEMAIL" instr not if { "There was no answer at the remote phone. Please try your call again later." }tell else { "There was no answer at the remote phone. If you wish to leave voicemail, please use +vm/send " target @ ph.num "=" }tell then source @ "talkingto" 0 setprop target @ "talkingto" 0 setprop source @ "caller" 0 setprop target @ "caller" 0 setprop then ; : ph.answer var source var target var psource var ptarget 301 ph.disp trig location source ! source @ "caller" getprop not if 401 ph.disp exit then source @ "caller" getprop findphone target ! source @ location psource ! target @ location ptarget ! source @ "talkingto" ptarget @ setprop target @ "talkingto" psource @ setprop psource @ { "Message 200: " 200 ph.msg }cat "Phone" pretty ansi_notify ptarget @ { "Message 200: " 200 ph.msg }cat "Phone" pretty ansi_notify psource @ { "The person on the other end sounds like a " ptarget @ "sex" getprop " " ptarget @ "species" getprop "." }cat "Phone" pretty ansi_notify ptarget @ { "The person on the other end sounds like a " psource @ "sex" getprop " " psource @ "species" getprop "." }cat "Phone" pretty ansi_notify ; : ph.hangup var source var target var psource var ptarget trig location source ! me @ psource ! source @ "caller" getprop not if 401 ph.disp exit then trig location "caller" getprop findphone target ! target @ location ptarget ! psource @ { "Message 501: " 501 ph.msg }cat "Phone" pretty ansi_notify ptarget @ { "Message 502: " 502 ph.msg }cat "Phone" pretty ansi_notify source @ "talkingto" 0 setprop target @ "talkingto" 0 setprop source @ "caller" 0 setprop target @ "caller" 0 setprop source @ "ring" 0 setprop target @ "ring" 0 setprop ; : ph.talk var ptarget trig location "talkingto" getprop ptarget ! ptarget @ not if 401 ph.disp else me @ { "^YELLOW^You " me @ "_say/def/say" getpropstr dup not if pop "say" then "" "," subst " to the person on the phone, "\"" param @ "\"^NORMAL^" }cat ansi_notify me @ location me @ { me @ " " me @ "_say/def/osay" getpropstr dup not if pop "says" then "" "," subst " to the person on the phone, "\"" param @ "\"" }cat ansi_notify_except ptarget @ { "^YELLOW^The person on the phone " me @ "_say/def/osay" getpropstr dup not if pop "says" then "" "," subst ", "\"" param @ "\"" }cat ansi_notify then ; : ph.upgrade var phnum var feature var target param @ "=" split feature ! phnum ! phnum @ not if { "You must specify a phone number." }tell exit then feature @ not if { "You must specify a feature." }tell exit then phnum @ findphone target ! target @ #-1 dbcmp if 404 ph.disp exit then target @ #-2 dbcmp if 691 ph.disp exit then ; : vm.list trig location "VoiceMail" ph.feature? if 550 ph.disp trig recycle exit then ; : vm.send ; : vm.del trig location "VoiceMail" ph.feature? if 550 ph.disp trig recycle exit then ; : ph.turnon trig location "ph.on" 1 setstat { "Your telephone is now ON." }tell ; : ph.turnoff trig location "ph.on" 0 setstat { "Your telephone is now OFF." }tell ; : ph.411 var issues var target var actual 0 actual ! #-1 "*" "T" find_array "@rp/ph.num" "???-????" array_filter_prop "@rp/ph.dir" { "*" param @ "*" }cat array_filter_prop issues ! { "411 for " param @ }cat header tellme issues @ foreach target ! pop target @ ph.dir string? if { "^CYAN^" target @ ph.num tostr 10 lj "^YELLOW^" target @ ph.dir tostr 68 lj "^NORMAL^" }cat tellme actual ++ then repeat { actual @ " entries found." }cat footer tellme ; : ph.anac var issues var target trig location "ANAC" ph.feature? if 550 ph.disp trig recycle exit then #-1 "*" "T" find_array "@rp/ph.num" param @ array_filter_prop issues ! { "Reverse 411 for " param @ }cat header tellme issues @ foreach target ! pop { "^CYAN^" target @ ph.num tostr 10 lj "^YELLOW^" target @ ph.dir tostr 68 lj "^NORMAL^" }cat tellme repeat { issues @ array_count " entries found." }cat footer tellme ; : ph.help command @ "+phone" smatch if ph.basicactioncheck then { "+phone system by Alynna (C) 2003" " " "Extra (F)eatures - (N)ot implemented yet - (W)iz only" " " { " +phone/buy Buy a phone for " ph.price " " moneyprop }cat " +phone/on Turn the phone on" " +phone/off Turn the phone off" " +phone/dir Change your info in +411" " +411 Search Directory Assistance for the text specified" " +phone/features List features available, ones you have are in green" " +phone/upgrade (N) Add features" " +dial Call someone" " +redial Dial the last number called" " +answer Answer a call" " +hangup Hang up the phone" " - Talk on the phone" " +anac <#> (F)(N) Look up the name for a number" " +vm (F)(N) Review your voice mail" " +vm/del <#/ALL> (F)(N) Delete voice mail" " +vm/send <#>= (F)(N) Send voice mail, if number ommitted, then to last number" " +sd (F)(N) Speed dial an entry" " +sd/set =<#> (F)(N) Set a speed dial entry" " +sd/del (F)(N) Remove an entry" " +*69 (F)(N) Dial the last person who called you" " look phone Look at your phone" }array atellme ; : ph.featurelist var issues var target prog "_ph/features" array_get_propdirs issues ! { "Addable phone features" }cat header tellme issues @ foreach target ! pop { trig location ph.features if "^GREEN^" else "^RED^" then target @ capitalize 15 lj "^YELLOW^" prog { "_ph/features/" target @ "/cost" }cat getprop tostr 5 lj "^CYAN^" prog { "_ph/features/" target @ "/desc" }cat getprop "^NORMAL^" }cat tellme repeat { issues @ array_count " entries found." }cat footer tellme ; : ph.main param ! ph.basicactioncheck command @ case "{+phone|+phone/help}" smatch when ph.help end "+phone/on" smatch when ph.turnon end "+phone/off" smatch when ph.turnoff end "+phone/features" smatch when ph.featurelist end "+phone/upgrade" smatch when ph.upgrade end "+phone/dir" smatch when ph.relist end "{+dial|+redial}" smatch when ph.dial end "+answer" smatch when ph.answer end "+hangup" smatch when ph.hangup end "-" smatch when ph.talk end "+vm/del" smatch when vm.del end "+vm" smatch when vm.list end "+phone/buy" smatch when ph.create end "+411" smatch when ph.411 end "+anac" smatch when ph.anac end endcase ; . c q @propset #7270=str:/_ph/desc:This phone is one of the standard models{nl}that nearly everyone has, a Daravon 7270.{nl}^CYAN^Phone #: $PHONE^NORMAL^{nl}^YELLOW^Caller#: {prop:caller,this} @propset #7270=str:/_ph/name:Phone: Daravon 7270 @propset #7270=float:/_ph/price:20.0000000000000 lsedit #7270=_phoneimg .del 1 100 ^YELLOW^() ^WHITE^|| ^WHITE^|| ^GRAY^/----------------------------\\ ^GRAY^| ^CYAN^Daravon Communicator 7270 ^GRAY^| ^GRAY^+----------------------------+ ^GRAY^| . . . . . . . . . . . . . | ^GRAY^| . . . . . . . . . . . . . | ^GRAY^| . . . . . . . . . . . . . | ^GRAY^+----------------------------+ ^GRAY^|^GREEN^ Phone Number: {left:{prop:mynum,this},8} ^GRAY^| ^GRAY^|^GREEN^ Current Caller: {left:{prop:caller,this},8} ^GRAY^| ^GRAY^|^GREEN^ Last Called: {left:{prop:lastcalled,this},8} ^GRAY^| ^GRAY^|^GREEN^ Last Caller: {left:{prop:lastcaller,this},8} ^GRAY^| ^GRAY^+--------+---------+---------+ ^GRAY^|^WHITE^ Q Z ^GRAY^|^WHITE^ A B C ^GRAY^|^WHITE^ D E F ^GRAY^| ^GRAY^|^WHITE^ 1 ^GRAY^|^WHITE^ 2 ^GRAY^|^WHITE^ 3 ^GRAY^| ^GRAY^+--------+---------+---------+ ^GRAY^|^WHITE^ G H I ^GRAY^|^WHITE^ J K L ^GRAY^|^WHITE^ M N O ^GRAY^| ^GRAY^|^WHITE^ 4 ^GRAY^|^WHITE^ 5 ^GRAY^|^WHITE^ 6 ^GRAY^| ^GRAY^+--------+---------+---------+ ^GRAY^|^WHITE^ P R S ^GRAY^|^WHITE^ T U V ^GRAY^|^WHITE^ W X Y ^GRAY^| ^GRAY^|^WHITE^ 7 ^GRAY^|^WHITE^ 8 ^GRAY^|^WHITE^ 9 ^GRAY^| ^GRAY^+--------+---------+---------+ ^GRAY^|^WHITE^ . ! & ^GRAY^|^WHITE^ $ ? @ ^GRAY^|^WHITE^ _ : / ^GRAY^| ^GRAY^|^WHITE^ # ^GRAY^|^WHITE^ 0 ^GRAY^|^WHITE^ * ^GRAY^| ^GRAY^+--------+---------+---------+ ^GRAY^\\ . . . . . . . . . . . . . ./ ^GRAY^ \\ . . . . . . . . . . . . ./ ^GRAY^ \\________________________/ .end