YASSE Mine (script)

From Elanthipedia
Jump to navigation Jump to search
YASSE Mine (script)
Category utility
Front-end YASSE
Author Antendren


Description

Mines a room, deeding any resources it is set to keep. If your right hand is empty or has a shovel, will pull out your pickaxe to start. Uses "prospect careful" and switches to a shovel once you hit metal. After 5 mines without any resources, uses prospect to check if the room is dry.

You must have a gettable and stowable shovel, pickaxe (unless using the "shovel" argument) and packet of deeds (unless using the "push" or "nograb" argument), and have coin for pushing (unless using the "packet" or "nograb" argument).

Syntax

Run as .mine <arg1> <arg2> <arg3>...

Supports the following optional arguments:

  • shovel - Causes the script to begin with a shovel instead of a pickaxe.
  • nograb - Causes the script to ignore all resources, and simply mine the room out.
  • packet - Causes the script to use a deed packet for every drop.
  • push - Causes the script to push all drops without a packet (trumped by "packet").
  • help - Outputs this information.

If you want to change which resources it keeps, edit the $KEEP$ variable.


Script

# Mines, and keeps any materials in the $KEEP$ list.
# If your right hand is empty or has a shovel, will pull out your pickaxe to start.
# Uses "prospect careful" and switches to a shovel once you hit metal.
# By default, appraises materials and then either pushes or pushes with a packet, whichever is cheaper.
# Can be called with the following optional arguments:
#	shovel - Causes the script to begin with a shovel instead of a pickaxe.
#	nograb - Causes the script to ignore all resources, and simply mine the room out.
#	packet - Causes the script to use a deed packet for every drop.
#	push - Causes the script to push all drops without a packet (trumped by "packet").
#	help - Outputs this.

setvariable KEEP "covellite iron silver animite audrualm damite darkstone electrum glaes gold haralun kertig lumium niniam orichalcum platinum tyrium"

action "A bitter smell seeps into the air." setvariable DANGER YES
action "The ground rumbles ominously." setvariable DANGER YES
action "The floor shudders briefly, causing" setvariable DANGER YES
action "scratches a diagram of a much safer angle" setvariable DANGER NO
action "A spill of stone reveals the faint glimmer of metal beneath!" setvariable CAREFUL YES

setvariable CAREFUL NO

setvariable args "%1%2%3%4%5%6%7%8%9"

if $args$ contains help
	goto HELP

if $args$ contains shovel
	begin
	if %righthanditem contains "pickaxe"
		begin
		put stow my pickaxe
		waitfor you put
		end
	if %righthanditem eq "Empty "
		begin
		put get my shovel
		waitfor You get
		end
	end
else
	begin
	if %righthanditem contains "shovel"
		begin
		put stow my shovel
		waitfor you put
		end
	if %righthanditem eq "Empty "
		begin
		put get my pickaxe
		waitfor You get
		end
	end


counter set 0
if $args$ contains nograb
	goto MINE

KEEP-LOOP:
	counter inc
	getword %c $KEEP$
	if %w eq ""
		begin
		counter set 0
		goto MINE
		end
	case GET $w$
	goto KEEP-LOOP


####


MINE:
	speed normal
	counter inc
	if $DANGER$ eq "YES" goto DANGER
	if $CAREFUL$ eq YES goto CAREFUL

	if $DEAD-MOB$ eq "YES" goto LOOT

	if_c > 5
		goto PROSPECT
	speed fast
	match GOODIES topples free.
	match GOODIES visible on the ground
	match GOODIES falls to the ground
	match PINNED You seem to be pinned in place.
	match UNCONSCIOUS blackness consumes your vision and your mind goes blank.
	match BEANED A large, oblong fragment slams into your forehead
	match END but the underlying material appears unsalvageable.
	match END the remaining material appears to be damaged beyond usefulness.
	match END This area may not be suitable to mine for some time.
	match MINE Roundtime
	put mine
	matchwait


DANGER:
	setvariable DANGER "NO"
	match MINE find nothing of concern lurking
	match MINE Your analysis has shown a way to significantly reduce
	match DANGER Unfortunately, you are unable
	match DANGER to somewhat reduce
	match END XXXX
	put prospect danger
	matchwait


####


GOODIES:
	counter set 0
	setvariable temp %l
	speed normal
GOODIES-1:
	caseswitch $temp$
	goto MINE
GET:
	setvariable temp %l-
	setvariable temp2 %l
	calculate temp2 pos $m$
	calculate temp2 right %result
	getword 2 $temp2$
	setvariable push-targ %w

	if "pebble stone" contains $push-targ$ goto GOODIES-1

	if $args$ contains packet
		goto PACKET-PUSH

	if $args$ contains push
		goto PLAIN-PUSH

	goto GOODY-APP


####


GOODY-APP-RETREAT:
	put retreat
GOODY-APP:
	match GOODY-APP-RETREAT You cannot appraise that when you are in combat!
	match GOODY-APP-2 kronars.
	match GOODY-APP-2 lirums.
	match GOODY-APP-2 dokoras.
	put app $push-targ$ quick
	matchwait
GOODY-APP-2:
	getword -2 %l
	setvariable value %w
	getword -1 %l
	if %w eq dokoras
		begin
		calculate value mul 11
		calculate value div 10
		end
	if %w eq kronars
		begin
		calculate value mul 8
		calculate value div 10
		end
	calculate value div 10
	if $value$ > 100
		goto PACKET-PUSH
	goto PLAIN-PUSH


####


PLAIN-PUSH:
	match DEED-STOW hands you a deed
	match PACKET-PUSH You realize you lack the money to trade in the nugget for a deed.
	match PACKET-PUSH XXXX
	match GOODIES-1 recently mined by someone else
	put push $push-targ$
	matchwait

DEED-STOW:
	put stow deed
	waitfor You put your
	goto GOODIES-1

PACKET-PUSH:
	match PACKET-STOW and tear off a claim notice from your packet.
	match END What were you referring to?
	put get my deed packet\npush $push-targ$ with my packet
	matchwait

PACKET-STOW:
	put stow my packet
	waitfor You put your
	goto DEED-STOW


####


PROSPECT:
	match DANGER continued mining XXXX
	match MORE can be mined here.
	match END Roundtime
	put prospect
	matchwait

MORE:
	counter set 0
	goto MINE

CAREFUL:
	setvariable CAREFUL NO
	if $args$ contains nograb goto MINE
	if %righthanditem contains pickaxe
		begin
		put stow my pickaxe
		waitfor You put your
		put get my shovel
		waitfor You get a
		end
	put prospect careful
	waitfor You carefully scan the area
	goto MINE


####


PINNED:
	setvariable DANGER NO
	waitfor to lever yourself free.
	goto MINE

UNCONSCIOUS:
	setvariable DANGER NO
	waitfor You peacefully awaken, feeling refreshed.
	goto MINE

BEANED:
	setvariable DANGER NO
	waitfor The world slowly comes into focus again,
	goto STAND

STAND:
	match STAND weight
	match STAND so unbalanced
	match MINE You stand back up
	put stand
	matchwait

####

HELP:
	boxmessage Mines, and keeps any materials in the $KEEP$ list.\nBy default, appraises materials and then either pushes or pushes with a packet, whichever is cheaper.\nCan be called with the following arguments:\nshovel - Causes the script to begin with a shovel instead of a pickaxe.\nnograb - Causes the script to ignore all resources, and simply mine the room out.\npacket - Causes the script to use a deed packet for every drop.\npush - Causes the script to skip appraising and push drops without a packet (trumped by "packet").\nhelp - This output.
	exit


####


END:
	exit