YASSE Mine (script)

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


Contents

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. Switches to a shovel once you hit metal or a material the script is set to keep. After 5 mines without any resources, uses prospect to check if the room is dry; if so, and prospect careful hasn't yet been used, it will prospect careful.

Deeds resources by appraising them and then either pushing or using a deed packet, whichever is cheaper.

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 (will not prospect careful).
  • 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.

Changelog

  • 08/15/2011: Added a missing section for swapping to the shovel (not sure how that was left out). Added a catch for injury via detonation.
  • 07/27/2011: Changed prospect careful to happen at the end of the mining, to increase the odds of rare drops. Added a catch for overly damaged tools and prevented "tin" from firing off "tiny nugget".

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.
# Switches to a shovel once you hit metal.
# Uses prospect careful once the room runs dry.
# 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 (will not prospect careful).
#	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 SHOVEL-SWAP YES

setvariable CAREFUL NO
setvariable SHOVEL-SWAP 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 $SHOVEL-SWAP$ eq "YES" goto SHOVEL-SWAP

	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 HURT and are rewarded with a detonation of rocky fragments!
	match EMPTY but the underlying material appears unsalvageable.
	match EMPTY the remaining material appears to be damaged beyond usefulness.
	match EMPTY This area may not be suitable to mine for some time.
	match MINE Roundtime
	match END but it appears to be too damaged to make much progress.
	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 MINE 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:
	if %righthanditem contains "pickaxe"
		setvariable SHOVEL-SWAP YES
	setvariable temp %l-
	setvariable temp2 %l
	calculate temp2 pos $m$
	calculate temp2 right %result

	getword 1 $temp2$
	if $keep$ excludes $w$ goto GOODIES-1

	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
	match NO-WORKERS This area has no workers present to help haul away your items.
	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

NO-WORKERS:
	setvariable args "$args$ packet"
	goto PACKET-PUSH

PACKET-PUSH:
	match PACKET-STOW and tear off a claim notice from your packet.
	match END What were you referring to?
	match SCREW-UP I don't think pushing that would have any effect.
	put get my deed packet\npush $push-targ$ with my packet
	matchwait

SCREW-UP:
	put stow my packet
	waitfor You put your
	goto GOODIES-1

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 EMPTY Roundtime
	put prospect
	matchwait

MORE:
	counter set 0
	goto MINE

EMPTY:
	if $args$ contains "nograb" goto END
	if $CAREFUL$ eq "YES" goto END
	put prospect careful
	waitfor You carefully scan the area
	setvariable CAREFUL YES
	goto MINE


####


SHOVEL-SWAP:
	setvariable SHOVEL-SWAP 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
	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

HURT:
	setvariable DANGER NO
	echo ======================
	echo 
	echo YOU HAVE BEEN INJURED!
	echo
	echo ======================
	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

Personal tools
SUPPORT ELANTHIPEDIA