Postal Services Code

For builders to discuss and ask building questions.
Post Reply
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Postal Services Code

Post by Harroghty » Sun Mar 27, 2016 5:54 pm

Here are some of the relevant progs for postal services. The post will need to somehow sell or issue letters (i39950) and packages (i39951). The basic programs here from Annah in Waterdeep should get you 90% of the way to implementing this in other areas.

Code: Select all

>greet_prog 100~
if quest(0,1,self) == 0
  if questr(39900,16,1,$n) == 1
    sayto $n You are no longer welcome here!
    mpechoat $n {90}$I points a wand at you and utters a word!
    mpechoaround $n ${90}I points a wand at @N and utters a word!
    mpechoat $n {90}Suddenly, your surroundings change.
    mpechoaround $n {90}Suddenly, @N disappears!
    mptransfer $n 8065
    mpat 8065 mpforce $n look
    mpat 8065 mpechoaround $n {90}Suddenly, @N appears out of nowhere!
  else
    if questr(39900,17,2,$n) == 0
      sayto $n Welcome to you. Should you wish to send
      sayto $n a letter or a mail box, please take
      sayto $n a look at the sign on the wall.
      sayto $n If you come to see if there is a letter or
      sayto $n a mail box for you, just ask me to check!
    else
      if questr(39900,17,2,$n) == 1
        sayto $n Welcome back. You have already paid
        sayto $n the fee for a letter. Just hand it to
        sayto $n me when it is labelled.
      else
        if questr(39900,17,2,$n) == 2
          sayto $n Welcome back. You have already paid
          sayto $n the fee for a mail box. Just hand it
          sayto $n to me when it it labelled.
        endif
      endif
    endif
  endif
  mpmset self quest 0 1 1
  mpgoto 99
  mpregoto
else
  mpmset self quest 0 1 0
endif
~
>bribe_prog 100~
mpjunk all.coins
mpecho {70}$I sends an assistant to check for new letters or boxes.
sayto $n That should not be too long.
mpgoto 40740
get $n
mpgoto 40741
drop $n
if ovnumhere(39950) > 0
or ovnumhere(39951) > 0
  get $n
  mpgoto 39950
  mpecho {70}$I smiles as the assistant returns a few minutes later, with something in his hands.
  mpgive $n $n
  sayto $n Here you are!
else
  mpgoto 39950
  mpecho {70}$I shrugs as the assistants returns a few minutes later, empty-handed.
  sayto $n We have nothing for you right now, sorry.
  mpmakecash 1 gold
  mpgive 1 gold $n
  drop 1 gold
endif
~
>give_prog i39950~
if questr(39900,17,2,$n) == 1
  if objval5($o) == 1
    mpmset $n questr 39900 17 2 0
    mposet $o value5 2
    sayto $n Very well. Everything looks in order.
    mpecho {70}$I calls and an assistant comes to take the letter.
    mplog MAIL: $n has placed a letter in the mail storeroom!
    mpgoto 40740
    drop $o
    mpgoto 39950
  else
    if objval5($o) == 0
      shake $n
      sayto $n You must label it first!
    else
      sayto $n You can't use this old letter again.
      sayto $n Buy a new one from my assistant!
    endif
    mpgive $o $n
    mpechoat $n {70}$I hands you the box back.
    mpechoaround $n {70}$I hands @N the box back.
  endif
else
  shake $n
  sayto $n You need to pay the fee first.
  mpecho $I points to the sign on the wall.
  mpgive $o $n
  mpechoat $n {70}$I hands you the letter back.
  mpechoaround $n {70}$I hands @N the letter back.
endif
~
>give_prog i39951~
if questr(39900,17,2,$n) == 2
  if objval5($o) == 1
    mpmset $n questr 39900 17 2 0
    mposet $o value5 2
    sayto $n Very well. Everything looks in order.
    mpecho {70}$I calls and an assistant comes to take the mail box.
    mplog MAIL: $n has placed a mail box in the mail storeroom!
    mpgoto 40740
    drop $o
    mpgoto 39950
  else
    if objval5($o) == 0
      shake $n
      sayto $n You must label it first!
    else
      sayto $n You can't use this old mail box again.
      sayto $n Buy a new one from my assistant!
    endif
    mpgive $o $n
    mpechoat $n $I hands you the box back.
    mpechoaround $n $I hands @N the box back.
  endif
else
  shake $n
  sayto $n You need to pay the fee first!
  mpecho $I points to the sign on the wall.
  mpgive $o $n
  mpechoat $n $I hands you the box back.
  mpechoaround $n $I hands @N the box back.
endif
~
A note on this one. I found, in applying this to Dhedluk, that I had to include a pause to prevent this from responding twice. Not sure why that happened, but a pause 2 in the process should fix that.

Code: Select all

>speech_prog check~
hmm
mpecho $I takes a look at the large registry in front of her.
mpgoto 40740
get $n
mpgoto 40741
drop $n
if ovnumhere(39950) > 0
or ovnumhere(39951) > 0
  get $n
  mpgoto 40740
  drop $n
  mpgoto 39950
  sayto $n Ah yes, we have something for you.
  sayto $n I am not sure if it is a letter or a box though.
  sayto $n The fee to get the item is 1 gold.
else
  mpgoto 39950
  shake $n
  sayto $n We have nothing for you.
endif
~
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Post Reply