YASSE Hunt (script)

From Elanthipedia
Jump to navigation Jump to search
YASSE Hunt (script)
Category Combat,Utility
Front-end YASSE
Author Antendren


Description

Puts "hunt", then finds the room with the most critters and no PCs and hunts to the last critter in that room. When it gets there, if the room does have a PC, it moves away until it finds a room with no PCs, then tries again. If, during the RT for hunt, a critter starts to advance on you, the script will end.

Syntax

Run as .hunt

No arguments used.

Script

action "to advance on you" setvariable CRITTER-IN-ROOM yes
action "You'll need to disengage first." goto END
action "Your prey seems to have completely vanished." goto START
action "You don't have that target currently available." goto START
action "You'll need to be in the area you found the tracks in order to hunt along them." goto START


START:
	setvariable firstChoice ""
	setvariable numFoes 0

	setvariable CRITTER-IN-ROOM no

	put hunt
	record until "Roundtime"


# FINDS THE START OF A ROOM.
ROOM-FIND:
	read recorded
	if %l contains "To the" goto PC-CHECK
	if %l contains "Roundtime" goto HUNT
	if %l contains "You were unable to locate any followable tracks." goto NOTHING
	goto ROOM-FIND


# CHECKS IF THE ROOMS HAS A PC.  RETURNS TO ROOM-FIND IF SO.
PC-CHECK:
	counter set 0
	read recorded
	if %l contains ")   a hidden" goto ROOM-FIND
	if %l contains ")   a " goto CRITTER-COUNT
	if %l contains ")   an " goto CRITTER-COUNT
	goto ROOM-FIND


# COUNTS THE NUMBER OF CRITTERS IN THE ROOM.  PUTS THE HUNT-NUMBER OF THE CRITTER IN $TEMP$.
CRITTER-COUNT:
	setvariable temp %l
	if $temp$ contains ")   a "
		calculate temp pos ")   a "
	else
		calculate temp pos ")   an "
	calculate temp left %result
	calculate temp right 2
	counter inc
	read recorded
	if %l eq "" goto ROOM-COMPARE
	goto CRITTER-COUNT


# COMPARES THE JUST COUNTED ROOM TO THE BEST FOUND SO FAR.  IF IT'S BETTER, STORES THE HUNT-NUMBER OF THE LAST CRITTER IN THAT ROOM.
ROOM-COMPARE:
	if_c > $numFoes$
		begin
		setvariable firstChoice $temp$
		setvariable numFoes %c
		end
	goto ROOM-FIND


# IF THERE'S A CRITTER IN YOUR ROOM, ENDS THE SCRIPT.
# OTHERWISE, HUNTS TO THE LAST CRITTER IN THE BEST ROOM, ASSUMING YOU FOUND ANY.
# IF THERE'S ALREADY A PC THERE, GOES TO MOVE-AWAY.
HUNT:
	if $CRITTER-IN-ROOM$ eq "yes" goto END
	if $firstChoice$ eq "" goto NOTHING

	put hunt $firstChoice$
	waitfor You move to hunt down your prey
	pause 2
	if %alsohere ne ""
		goto MOVE-AWAY
	goto END


# YOU WERE UNABLE TO FIND AN UNCLAIMED ROOM WITH CRITTERS.  BY DEFAULT, THE SCRIPT RESTARTS.  MAYBE HAVE IT DO SOMETHING ELSE?
NOTHING:
	goto START


####


# MOVES IN A RANDOM CARDINAL DIRECTION.  IF NONE ARE VISIBLE, TRIES A DIRECTION AT RANDOM.  ONCE IT FINDS A ROOM WITH NO CRITTERS, RESTARTS.
MOVE-AWAY:
	setvariable exits ""
	counter set 0
	setvariable temp %roomdescription
	calculate temp pos obvious
	calculate temp right %result
	if %temp contains "north,"
		begin
		setvariable exits "$exits$ n"
		counter inc
		end
	if %temp contains "north."
		begin
		setvariable exits "$exits$ n"
		counter inc
		end
	if %temp contains "south,"
		begin
		setvariable exits "$exits$ s"
		counter inc
		end
	if %temp contains "south."
		begin
		setvariable exits "$exits$ s"
		counter inc
		end
	if %temp contains " east"
		begin
		setvariable exits "$exits$ e"
		counter inc
		end
	if %temp contains " west"
		begin
		setvariable exits "$exits$ w"
		counter inc
		end
	if %temp contains "northeast"
		begin
		setvariable exits "$exits$ ne"
		counter inc
		end
	if %temp contains "southeast"
		begin
		setvariable exits "$exits$ se"
		counter inc
		end
	if %temp contains "northwest"
		begin
		setvariable exits "$exits$ nw"
		counter inc
		end
	if %temp contains "southwest"
		begin
		setvariable exits "$exits$ sw"
		counter inc
		end
	if %temp contains " out"
		begin
		setvariable exits "$exits$ out"
		counter inc
		end
	if $exits$ eq ""
		begin
		setvariable exits "n nw w sw s se e ne u d o"
		counter set 11
		end
	action "You are engaged to a" goto RETR


MOVE-1:
	counter rnd %c
	getword %c $exits$
	put %w
	pausetext 3 "Obvious"
	action "You are engaged to a" CLEAR

	if %alsohere ne ""
		goto MOVE-AWAY

	goto START

RETR:
	put retreat
	goto MOVE-1


####


END:
	exit