Custom Vendors

For builders to discuss and ask building questions.
Post Reply
hasryn
Sword Grand Master
Sword Grand Master
Posts: 255
Joined: Tue Dec 24, 2013 9:18 pm

Custom Vendors

Post by hasryn » Mon Feb 22, 2016 2:08 am

Is there a sample for customized vendors. Where you start with a generic item and it comes out the color or whichever option you chose? Like the scabbard vendor in Waterdeep? I am trying to figure this out for a tattoo shop, but am not doing so well. If I can have something to study it would give me better insight.
User avatar
Algon
Sword Grand Master
Sword Grand Master
Posts: 1070
Joined: Thu Aug 14, 2003 12:44 am
Location: Waterdeep

Re: New Sample Area

Post by Algon » Mon Feb 22, 2016 3:27 am

hasryn wrote:Is there a sample for customized vendors. Where you start with a generic item and it comes out the color or whichever option you chose? Like the scabbard vendor in Waterdeep? I am trying to figure this out for a tattoo shop, but am not doing so well. If I can have something to study it would give me better insight.
Here is the lesson you need to check out for that.
http://www.forgottenkingdoms.org/builde ... object.php

Code: Select all

You are restringing the object's descriptions. For example...
>intercept_prog green book~
mpecho Bob picks up a green book off the shelf. 
(Here you would load up a base object, we will call it blank book) 
mpoload QQ00 (blank book)
mpquiet on
mpgive book $n 
mpquiet off 
mposet on $n iQQ00 name iQQ00 Green book
mposet on $n iQQ00 short {F0}Green book
mposet on $n iQQ00 long {F0}Green book
This is a very basic way to do this, of course it would need to be tweaked to fit your needs. But it is basically how this would work. Feel free to contact me via PM or whatever if you need help.
Counting bodies like sheep...to the rhythm of the war drums. ~~~ Maynard
hasryn
Sword Grand Master
Sword Grand Master
Posts: 255
Joined: Tue Dec 24, 2013 9:18 pm

Re: Custom Vendors

Post by hasryn » Mon Feb 22, 2016 12:57 pm

What about the list another intercept prog when you set it to for example 'look wall' And you get the list of your choices and gives you the command to put in.
User avatar
Algon
Sword Grand Master
Sword Grand Master
Posts: 1070
Joined: Thu Aug 14, 2003 12:44 am
Location: Waterdeep

Re: Custom Vendors

Post by Algon » Mon Feb 22, 2016 1:35 pm

hasryn wrote:What about the list another intercept prog when you set it to for example 'look wall' And you get the list of your choices and gives you the command to put in.
Yeah, you can accomplish this via extra descriptions in the room. Example...

Code: Select all

Room description.

This room is awesome and has a big red sign on the wall. 
~
E
red sign~
Green book  --- 5 platinum
Red book    --- 6 platinum
Blue Book   --- 7 platinum. 
~
This way the sign is where people can get info on what to do.
In this specific case, you would need give progs set up for each price, so they get a green book when they give 5 platinum, a red book when they hand him 6 platinum, and so on.
Counting bodies like sheep...to the rhythm of the war drums. ~~~ Maynard
User avatar
Larethiel
Sword Grand Master
Sword Grand Master
Posts: 910
Joined: Sat Jul 22, 2006 4:10 pm
Location: Mt. Whateverest

Re: Custom Vendors

Post by Larethiel » Mon Feb 22, 2016 1:46 pm

Or you do an intercept_prog list, if you wanted to have another option.

Code: Select all

>intercept_prog list~
  smote unpacks a bundle of wood.
  mpechoaround $n $I shows @N a selection of wood.
  mpechoat $n {30}a piece of X --------- {30}2 copper
  mpechoat $n {30}a moody teen ------ {30}3 copper
  mpechoat $n {30}a piece of Z ------- {30}4 copper
  mpechoat $n {30}a piece of a chimichanga ------ {30}5 copper
  mpechoat $n {30}a poster of Wade Wilson------ {30}6 copper
  smote nods gruffly.
  sayto $n Give me the coin for the type you want.
And then you could do a >bribe_prog for each number, starting with the biggest, followed by the restinging program, etc.
Weit in der Champagne im Mittsommergrün,
dort, wo zwischen Grabkreuzen Mohnblumen blühn,
da flüstern die Gräser und wiegen sich leicht
im Wind, der sanft über das Gräberfeld streicht.
hasryn
Sword Grand Master
Sword Grand Master
Posts: 255
Joined: Tue Dec 24, 2013 9:18 pm

Re: Custom Vendors

Post by hasryn » Mon Feb 22, 2016 2:07 pm

Thanks you two! Big big help
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Custom Vendors

Post by Harroghty » Mon Feb 22, 2016 4:06 pm

There are two ways to do this basically:

A BUY_PROG will rely upon QBITs and is best used for cases with limited choices available. Squire Barrit at the Bridge of Fallen Men uses this method to toggle his one choice for customization: color. In this case the NPC vendor sets a QBIT upon himself or the PC indicating which color, for example, he will make his wares and then uses a BUY_PROG to make sure that the object is assigned the correct color on purchase.

e.g.
Here he validates the quest bit which allows a PC to purchase, then sets a QBIT to toggle color choice.

Code: Select all

>speech_prog red~
if questr ( 110400, 20, 4, $n) == 12
  mpmset $n questr 110400 28 3 1
  sayto $n Something red then?  You'll get red until you name another color.
  sayto $n Or until you leave.
  smile
  sayto $n I have a terrible memory.
  sayto $n Now is it sharp or blunt?
  sayto $n Or something else?
  mpecho $I jerks his thumb at a rack behind him.
  sayto $n I can LIST them for you again.
endif
~
Here he checks for that quest bit again, to validate the process, then checks the QBIT for color toggle and colors the object which the PC just bought. The transaction and color happen so fast that it is all, so-to-speak, transparent for the PC purchaser.

Code: Select all

>buy_prog i110491~
if questr ( 110400, 20, 4, $n) == 12
  smote turns and pulls a lance from off the rack.
  if questr ( 110400, 28, 3, $n) == 1   
    mpmset $n questr 110400 28 3 1
    mposet on $n i110491 name i110491 wooden courtesy lance cronel head
    mposet on $n i110491 short {90}a wooden courtesy lance with {80}a cronel head
    mposet on $n i110491 long {90}A wooden courtesy lance with {80}a cronel head{90} lies here.
  else
    if questr ( 110400, 28, 3, $n) == 2   
      mpmset $n questr 110400 28 3 2
      mposet on $n i110491 name i110491 wooden courtesy lance cronel head
      mposet on $n i110491 short {20}a wooden courtesy lance with {80}a cronel head
      mposet on $n i110491 long {20}A wooden courtesy lance with {80}a cronel head{20} lies here.
    else
      if questr ( 110400, 28, 3, $n) == 3
        mpmset $n questr 110400 28 3 3
        mposet on $n i110491 name i110491 wooden courtesy lance cronel head
        mposet on $n i110491 short {60}a wooden courtesy lance with {80}a cronel head
        mposet on $n i110491 long {60}A wooden courtesy lance with {80}a cronel head{60} lies here.
      else
        if questr ( 110400, 28, 3, $n) == 4
          mpmset $n questr 110400 28 3 4
          mposet on $n i110491 name i110491 wooden courtesy lance cronel head
          mposet on $n i110491 short {80}a wooden courtesy lance with {80}a cronel head
          mposet on $n i110491 long {80}A wooden courtesy lance with {80}a cronel head{80} lies here.
        else
          if actorhasobjnum(110477)
          or actorhasobjnum(113002)
          or actorhasobjnum(113003)
            smote looks @$N over and then pulls a different color from another rack.
            mposet on $n i110491 name i110491 wooden courtesy lance cronel head
            mposet on $n i110491 short {50}a wooden courtesy lance with {80}a cronel head
            mposet on $n i110491 long {50}A wooden courtesy lance with {80}a cronel head{50} lies here.
          endif
        endif
      endif
    endif
  endif
endif
~
An INTERCEPT_PROG uses typically one QBIT only and can accommodate many, many choices. An example would be Bulart, the scabbard seller, who offers a choice of object type and color. In this case, the NPC vendor typically assigns the one QBIT when the PC pays them the desired amount of money (via a BRIBE_PROG) and then uses a nonstandard ordering keyword (like order) to process the sale. An INTERCEPT_PROG for, as an example, order will then check against subordinate strings to validate the sale and produce the object.

e.g.
Here he uses a SPEECH_PROG to respond to any mention of his wares. He checks if the customer has paid or not, responds appropriately, and then shows the options.

Code: Select all

>speech_prog scabbards scabbard weapons loop baldric baldrics loops sheath sheaths~
if questr(8400, 4, 1, $n) == 0
  smote steps back and points to his table.
  sayto $n I sell scabbards and weapon loops. Baldrics, too.
  pause 1
  sayto $n One platinum coin will buy you one in the color of your choosing.
  smote looks @$N over.
  pause 1
else
  if questr(8400, 4, 1, $n) == 1
    smote nods to @$N.
    sayto $n Which did you say that you wanted?
    pause 1
  endif
endif
mpechoat $n {B0}OOC {F0}To order:
mpechoat $n {F0}1. Pay Bulart one platinum.
mpechoat $n {F0}2. Select a type of sheath: scabbard, baldric, loop.
mpechoat $n {F0}3. Select a color:
mpechoat $n {00}..{90}red{00}..{10}ochre{00}..{20}green{00}..{B0}yellow{00}..{60}blue{00}..{80}black{00}..{70}gray{00}..{F0}white{00}........
mpechoat $n {00}.
mpechoat $n {00}..{F0}order2 type color
mpechoat $n {00}..{F0}e.g. {90}order2 scabbard red{F0} or {20}order2 baldric green
~
Here a BRIBE_PROG sets the QBIT for paid or not.

Code: Select all

>bribe_prog 500~
if questr(8400, 4, 1, $n) == 0
  mpjunk all.coins
  mpmset $n questr 8400 4 1 1
  smote pushes the coins into a purse on his belt and nods towards @$N.
  sayto $n Which do you wish then?
else
  mpjunk all.coins
  mpmakecash 1 platinum
  mpgive 1 platinum $n
  smote shakes his head and returns the coin quickly.
  sayto $n You have already paid me.
endif
~
Here he uses an INTERCEPT_PROG to apply the stringprefix values across the program. This can be done with more or less economy of coding, depending on the buyer's input. If, for example, you want to translate black to 80 then it will be longer. If the PC inputs {80} as the third word then you need only include $2 to drop that into place.

Code: Select all

>intercept_prog order2~
if questr(8400, 4, 1, $n) == 1
  smote nods to @$N and fetches an item from his table.
  sayto $n Come again if you have a need.
  if string($1)==scabbard
    if string($2)== red
      mpjunk all.i8218
      mpoload 8218
      mposet i8218 name i8218 red leather wrapped scabbard
      mposet i8218 short {90}a leather-wrapped scabbard
      mposet i8218 long {90}A leather-wrapped scabbard lies here.
      mpmset $n questr 8400 4 1 0
      mpgive $1 $n  
    else
      if string($2)== ochre
        mpjunk all.i8218
        mpoload 8218
        mposet i8218 name i8218 ochre leather wrapped scabbard
        mposet i8218 short {10}a leather-wrapped scabbard
        mposet i8218 long {10}A leather-wrapped scabbard lies here.
        mpmset $n questr 8400 4 1 0
        mpgive $1 $n  
      else
        if string($2)== green
          mpjunk all.i8218
          mpoload 8218
          mposet i8218 name i8218 green leather wrapped scabbard
          mposet i8218 short {20}a leather-wrapped scabbard
          mposet i8218 long {20}A leather-wrapped scabbard lies here.
          mpmset $n questr 8400 4 1 0
          mpgive $1 $n  
        else
          if string($2)== yellow
            mpjunk all.i8218
            mpoload 8218
            mposet i8218 name i8218 yellow leather wrapped scabbard
            mposet i8218 short {B0}a leather-wrapped scabbard
            mposet i8218 long {B0}A leather-wrapped scabbard lies here.
            mpmset $n questr 8400 4 1 0
            mpgive $1 $n    
          else
            if string($2)== blue
              mpjunk all.i8218
              mpoload 8218
              mposet i8218 name i8218 blue leather wrapped scabbard
              mposet i8218 short {60}a leather-wrapped scabbard
              mposet i8218 long {60}A leather-wrapped scabbard lies here.
              mpmset $n questr 8400 4 1 0
              mpgive $1 $n    
            else
              if string($2)== black
                mpjunk all.i8218
                mpoload 8218
                mposet i8218 name i8218 black leather wrapped scabbard
                mposet i8218 short {80}a leather-wrapped scabbard
                mposet i8218 long {80}A leather-wrapped scabbard lies here.
                mpmset $n questr 8400 4 1 0
                mpgive $1 $n
              else
                if string($2)== gray
                  mpjunk all.i8218
                  mpoload 8218
                  mposet i8218 name i8218 gray leather wrapped scabbard
                  mposet i8218 short {70}a leather-wrapped scabbard
                  mposet i8218 long {70}A leather-wrapped scabbard lies here.
                  mpmset $n questr 8400 4 1 0
                  mpgive $1 $n  
                else
                  if string($2)== white
                    mpjunk all.i8218
                    mpoload 8218
                    mposet i8218 name i8218 white leather wrapped scabbard
                    mposet i8218 short {F0}a leather-wrapped scabbard
                    mposet i8218 long {F0}A leather-wrapped scabbard lies here.
                    mpmset $n questr 8400 4 1 0
                    mpgive $1 $n
                  else
                    mpechoat $n {90}OOC: That is not an accepted option.
                  endif
                endif
              endif
            endif
          endif
        endif
      endif
    endif
  else
    if string($1)==baldric
      if string($2)== red
        mpjunk all.i8443
        mpoload 8443
        mposet i8443 name i8443 red leather baldric
        mposet i8443 short {90}a leather baldric
        mposet i8443 long {90}A leather baldric lies here.
        mpmset $n questr 8400 4 1 0
        mpgive $1 $n  
      else
        if string($2)== ochre
          mpjunk all.i8443
          mpoload 8443
          mposet i8443 name i8443 ochre leather baldric
          mposet i8443 short {10}a leather baldric
          mposet i8443 long {10}A leather baldric lies here.
          mpmset $n questr 8400 4 1 0
          mpgive $1 $n  
        else
          if string($2)== green
            mpjunk all.i8443
            mpoload 8443
            mposet i8443 name i8443 green leather baldric
            mposet i8443 short {20}a leather baldric
            mposet i8443 long {20}A leather baldric lies here.
            mpmset $n questr 8400 4 1 0
            mpgive $1 $n  
          else
            if string($2)== yellow
              mpjunk all.i8443
              mpoload 8443
              mposet i8443 name i8443 yellow leather baldric
              mposet i8443 short {B0}a leather baldric
              mposet i8443 long {B0}A leather baldric lies here.
              mpmset $n questr 8400 4 1 0
              mpgive $1 $n    
            else
              if string($2)== blue
                mpjunk all.i8443
                mpoload 8443
                mposet i8443 name i8443 blue leather baldric
                mposet i8443 short {60}a leather baldric
                mposet i8443 long {60}A leather baldric lies here.
                mpmset $n questr 8400 4 1 0
                mpgive $1 $n    
              else
                if string($2)== black
                  mpjunk all.i8443
                  mpoload 8443
                  mposet i8443 name i8443 black leather baldric
                  mposet i8443 short {80}a leather baldric
                  mposet i8443 long {80}A leather baldric lies here.
                  mpmset $n questr 8400 4 1 0
                  mpgive $1 $n
                else
                  if string($2)== gray
                    mpjunk all.i8443
                    mpoload 8443
                    mposet i8443 name i8443 gray leather baldric
                    mposet i8443 short {70}a leather baldric
                    mposet i8443 long {70}A leather baldric lies here.
                    mpmset $n questr 8400 4 1 0
                    mpgive $1 $n  
                  else
                    if string($2)== white
                      mpjunk all.i8443
                      mpoload 8443
                      mposet i8443 name i8443 white leather baldric
                      mposet i8443 short {F0}a leather baldric
                      mposet i8443 long {F0}A leather baldric lies here.
                      mpmset $n questr 8400 4 1 0
                      mpgive $1 $n
                    else
                      mpechoat $n {90}OOC: That is not an accepted option.
                    endif
                  endif
                endif
              endif
            endif
          endif
        endif
      endif
    else
      if string($1)==loop
        if string($2)== red
          mpjunk all.i8902
          mpoload 8902
          mposet i8902 name i8902 red leather weapons loop
          mposet i8902 short {90}a leather weapons loop
          mposet i8902 long {90}A leather weapons loop lies here.
          mpmset $n questr 8400 4 1 0
          mpgive $1 $n  
        else
          if string($2)== ochre
            mpjunk all.i8902
            mpoload 8902
            mposet i8902 name i8902 ochre leather weapons loop
            mposet i8902 short {10}a leather weapons loop
            mposet i8902 long {10}A leather weapons loop lies here.
            mpmset $n questr 8400 4 1 0
            mpgive $1 $n  
          else
            if string($2)== green
              mpjunk all.i8902
              mpoload 8902
              mposet i8902 name i8902 green leather weapons loop
              mposet i8902 short {20}a leather weapons loop
              mposet i8902 long {20}A leather weapons loop lies here.
              mpmset $n questr 8400 4 1 0
              mpgive $1 $n 
            else
              if string($2)== yellow
                mpjunk all.i8902
                mpoload 8902
                mposet i8902 name i8902 yellow leather weapons loop
                mposet i8902 short {B0}a leather weapons loop
                mposet i8902 long {B0}A leather weapons loop lies here.
                mpmset $n questr 8400 4 1 0
                mpgive $1 $n    
              else
                if string($2)== blue
                  mpjunk all.i8902
                  mpoload 8902
                  mposet i8902 name i8902 blue leather weapons loop
                  mposet i8902 short {60}a leather weapons loop
                  mposet i8902 long {60}A leather weapons loop lies here.
                  mpmset $n questr 8400 4 1 0
                  mpgive $1 $n    
                else
                  if string($2)== black
                    mpjunk all.i8902
                    mpoload 8902
                    mposet i8902 name i8902 black leather weapons loop
                    mposet i8902 short {80}a leather weapons loop
                    mposet i8902 long {80}A leather weapons loop lies here.
                    mpmset $n questr 8400 4 1 0
                    mpgive $1 $n 
                  else
                    if string($2)== gray
                      mpjunk all.i8902
                      mpoload 8902
                      mposet i8902 name i8902 gray leather weapons loop
                      mposet i8902 short {70}a leather weapons loop
                      mposet i8902 long {70}A leather weapons loop lies here.
                      mpmset $n questr 8400 4 1 0
                      mpgive $1 $n  
                    else
                      if string($2)== white
                        mpjunk all.i8902
                        mpoload 8902
                        mposet i8902 name i8902 white leather weapons loop
                        mposet i8902 short {F0}a leather weapons loop
                        mposet i8902 long {F0}A leather weapons loop lies here.
                        mpmset $n questr 8400 4 1 0
                        mpgive $1 $n
                      else
                        mpechoat $n {90}OOC: That is not an accepted option.
                      endif
                    endif
                  endif
                endif
              endif
            endif
          endif
        endif
      endif
    endif
  endif
else
  smote shakes his head from side to side.
  sayto $n You need to pay first.
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
hasryn
Sword Grand Master
Sword Grand Master
Posts: 255
Joined: Tue Dec 24, 2013 9:18 pm

Re: Custom Vendors

Post by hasryn » Tue Feb 23, 2016 3:09 am

Wow that helps a ton drew! Thank you all so very much!
Post Reply