Talk:Rikimari Mining Script

From Elanthipedia
Jump to navigation Jump to search

Rikimari, overall very thoughtful and well written. Many places could use some abreviation/shortening of the code. I'll try to put down some ideas here for your purusal...


prw:
pause
pr:
	match prw ...wait
	matchre %s /You are certain that (?:coal|oravir|tin|zinc|nickel|copper|covellite|lead) can be mined here/i
	matchre pdanger /You are certain that (:?electrum|darkstone|silver|audrualm|icesteel|gold|platinum|damite|lumium|glaes|silversteel|kertig|animite|haralun|muracite|niello|niniam|orichalcum|tyrium|vardite) can be mined here/i
	MATCH pr Miners stand ready
	MATCH %s Roundtime:
	put prospect
	MATCHWAIT

In order to facilitate future changes without doing a massive find and replace one thing you might want to consider would be to create a kind of sub routine for movement between rooms or anywhere you repeat code. Using the SF front end this is tricky/difficult to some extent and not impossible. Here is what I would do to the movement section to accomplish this.

Also when using matchre many punctuation marks, specifically in the case below, question marks and periods take on special meaning and carefully considering using them is wise. You can download a free regular expression tool at http://www.ultrapico.com/Expresso.htm it a really great way to check matchre’s and even build them!

I’ve added some comments above suggested changes briefly explaining why it might be wise to consider the change. Please don’t feel the need to add credits if you choose to incorporate any of this. Consider it humble payment for your help in game.

darktunnelsr1:
setvariable room darktunnelsr1
SAVE darktunnelsr2
# Add the dir2go variable to each room
setvariable dir2go go gap
# With all the variables set go to a single match table that will handle movement.
goto movematchsub


# Adding the movematchsubw eliminates the occasional screen scroll that simply returning to movematchsub can create.
movematchsubw:
pause
movematchsub:
	# Removed punctuation marks, they're really not needed.  Added /i at the end which makes the matchre case insensitive.
	# Trimmed expression so it's doesn't trail off to the right of the editor/screen.
	MATCHRE stand /while kneeling|must be standing|stand up first|Can't run or hide|while lying down/i
	# Removed punctuation, added /i case insensitive.
	MATCHRE retreat /at melee range|at pole weapon range|do that while engaged/i
	# Created matchre statement to account for the occasional can't type ahead even though it probably wouldn't happen.
	# The back slashes before each period tell matchre to treat the periods as literal periods.
	MATCHRE movematchsubw /^Sorry,|\.\.\.wait/i
	MATCH %s Also here
	# While the "Obvious paths" match might not occur in the mines it does in a significant elsewhere in the game.
	# More or less the same thing for "you can't see a thing" match.
	# Added them to demonstrate how a single well-conceived movement routine can be replicated and valid in any script.
	MATCHRE pr /Obvious (?:paths|exits)|you can't see a thing/i
        MATCH kneel tight fit
	PUT %dir2go
	MATCHWAIT

So without comments the first few lines of movement would now look like this and has the added bonus of shrinking the script;

darktunnelsr1:
setvariable room darktunnelsr1
SAVE darktunnelsr2
setvariable dir2go go gap
goto movematchsub

darktunnelsr2:
setvariable room darktunnelsr2
SAVE darktunnelsr3
setvariable dir2go southwest
goto movematchsub

darktunnelsr3:
setvariable room darktunnelsr3
SAVE darktunnelsr4
setvariable dir2go northwest
goto movematchsub

Etc...

movematchsubw:
pause
movematchsub:
	MATCHRE stand /while kneeling|must be standing|stand up first|Can't run or hide|while lying down/i
	MATCHRE retreat /at melee range|at pole weapon range|do that while engaged/i
	MATCHRE movematchsubw /^Sorry,|\.\.\.wait/i
        MATCH kneel tight fit
	MATCH %s Also here
	MATCHRE pr /Obvious (?:paths|exits)|you can't see a thing/i
	PUT %dir2go
	MATCHWAIT

PLEASE NOTE I HAVE NOT TESTED I am fairly certain of the accuracy/validity of my suggestions.
I would really love to know who is helping out, pleaes contact me via rikimari_dr, thanks!


Info

Please add Template:Script and it's info to this page. -Moderator Caraamon Makdasi(talk) 22:36, 23 June 2013 (UTC)