NPC locksmith script 05/26/2014 11:22 PM CDT
This script is kinda specialized, but I thought some of you might find it (or parts of it!) useful. I'll try to cover all the areas you'll need to modify with notes marked by "#". The script will run through three containers in sequence, followed by your disk once all containers are cleared, and attempt to get and open each type of box and empty the contents into the primary container. It uses go2 to retrieve more silver from the bank when necessary and also has a branch for selling cursed gems that can't be retrieved via the EMPTY command. If it encounters an item that for some reason can't be emptied and registers as of value or scripted when attempting to throw it away, it will exit and let you make the call (just in case!).

~Taverkin

DEBUG OFF
IF_6 GOTO DISKREP5
SETVARIABLE dr 5
SETVARIABLE vc 1
IF_5 GOTO CONTSEL
IF_1 GOTO SETALL

PUT stop 506
PUT rel
PUT inc 506
PUT rel
PAUSE 1

# The above 5 lines only apply to wizards who can cast haste. Also assumes rapid fire is running.

INITIALIZE:
PUT .open strongbox box chest trunk coffer

SETALL:
SETVARIABLE cont1 %1
SETVARIABLE cont2 %2
SETVARIABLE cont3 %3
ECHO
ECHO All containers set:
ECHO
ECHO Container 1 = %1
ECHO Container 2 = %2
ECHO Container 3 = %3
ECHO
EXIT

# The first time you run the script you will need to set container variables. Type ".open <container1> <container2> <container3>" to set containers.

NXTCONT4:
SETVARIABLE vc 2
IF_5 GOTO SHIFT
IF_4 GOTO SHIFT
IF_3 GOTO SHIFT
IF_2 GOTO SHIFT
IF_1 GOTO DISK
NXTCONT3:
SETVARIABLE vc 4
SETVARIABLE contc %cont3
GOTO BOX
NXTCONT2:
SETVARIABLE vc 3
SETVARIABLE contc %cont2
GOTO BOX
CONTSEL:
COUNTER SET 1
SETVARIABLE contc %cont1
SETVARIABLE vc 2
GOTO BOX

SHIFT:
SHIFT
SETVARIABLE contc %cont1
GOTO BOX

BOX2:
EXIT
BOX1:
COUNTER ADD 1
BOX:
PUT get %1 from my %contc
MATCH NXTCONT%vc Get what
MATCH BELL You remove
MATCH FULL free hand
MATCHWAIT

DISK:
PUT .open strongbox box chest trunk coffer .

DISKREP5:
COUNTER SET 4
SETVARIABLE dr %c
GOTO DISKSTART
DISKREP4:
SHIFT
COUNTER SET 3
SETVARIABLE dr %c
GOTO DISKSTART
DISKREP3:
SHIFT
COUNTER SET 2
SETVARIABLE dr %c
GOTO DISKSTART
DISKREP2:
SHIFT
COUNTER SET 1
SETVARIABLE dr %c
GOTO DISKSTART
DISKREP1:
SHIFT
COUNTER SET 0
SETVARIABLE dr %c
GOTO DISKSTART
DISKREP0:
EXIT

DISKSTART:
MATCH DISKREP%dr Get what?
MATCH EXIT You struggle
MATCH BELL You remove
PUT get %1 from Taverkin disk
MATCHWAIT

# Change the above line to reflect your character's name.

FULL:
PUT ring bell
MATCH STOW ignores you
MATCH BANK don't have enough!
MATCH OPEN Having paid,
PUT pay
MATCHWAIT

# Change the words "ring bell" to match your NPC locksmith activator.

STOW:
COUNTER DIVIDE 1
SETVARIABLE boxrep %c
PUT stow left
PUT stow right
GOTO BOX%boxrep

BELL:
PUT ring bell
MATCH BANK don't have enough!
MATCH OPEN Having paid,
PUT pay
MATCHWAIT

# Change the words "ring bell" to match your NPC locksmith activator.

OPEN:
PUT open my %1
PUT get coins from my %1
PAUSE 1
GOTO EMPTY%dr
EMPTY5:
MATCH SELL can't quite
MATCH SELL leaving the rest
MATCH SELL nothing will fit
MATCH EMPTY5 ...wait
MATCH TRASH everything falls in
MATCH TRASH nothing comes
PUT empty my %1 into my %cont1
MATCHWAIT

BANK:
PUT ;go2 bank
PAUSE 1
MATCH BANK Go see
MATCH RETURNB The teller
PUT withdraw 10000 silver
MATCHWAIT

RETURNB:
PUT ;go2 locksmith
PAUSE 1
GOTO BELL

RETURNG:
PUT ;go2 locksmith
PAUSE 1
GOTO TRASH

SELL:
PUT ;go2 gemshop
PAUSE 1
MATCH SELL no merchant
MATCH EXIT wasting my time
MATCH RETURNG removes the gems
PUT sell my %1
MATCHWAIT

# The preceding four labels in the script assume you use go2 scripts for the purposes of navigating in any town.

TRASH:
MATCH LOOK significant value
MATCH TRASH ...wait
MATCH BOX feel pleased
PUT put my %1 in barrel
MATCHWAIT

# Change the word "barrel" to reflect the trash receptacle at your NPC locksmith.

EMPTY4:
EMPTY3:
EMPTY2:
EMPTY1:
EMPTY0:
MATCH SELL can't quite
MATCH SELL leaving the rest
MATCH SELL nothing will fit
MATCH EMPTY%dr ...wait
MATCH ALTTRASH everything falls in
MATCH ALTTRASH nothing comes
PUT empty my %1 into my %cont1
MATCHWAIT

ALTTRASH:
MATCH LOOK significant value
MATCH ALTTRASH ...wait
MATCH DISKSTART feel pleased
PUT put my %1 in barrel
MATCHWAIT

# Change the word "barrel" to reflect the trash receptacle at your NPC locksmith.

LOOK:
PUT look in my %1
EXIT

EXIT:
EXIT
Reply