Talk:Rikimari Mining Script: Difference between revisions
(Created page with "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... ...") |
m (Deka, contact me!) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
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... |
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... |
||
<br> |
|||
match pr ...wait |
|||
<pre> |
|||
match %s You are certain that coal can be mined here |
|||
prw: |
|||
match %s You are certain that iron can be mined here |
|||
pause |
|||
match %s You are certain that oravir can be mined here |
|||
pr: |
|||
match %s You are certain that tin can be mined here |
|||
match prw ...wait |
|||
match %s You are certain that zinc can be mined here |
|||
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 %s You are certain that copper can be mined here |
|||
match %s You are certain that covellite can be mined here |
|||
match %s You are certain that lead can be mined here |
|||
match pdanger You are certain that electrum can be mined here |
|||
match pdanger You are certain that darkstone can be mined here |
|||
match pdanger You are certain that silver can be mined here |
|||
match pdanger You are certain that audrualm can be mined here |
|||
match pdanger You are certain that icesteel can be mined here |
|||
match pdanger You are certain that gold can be mined here |
|||
match pdanger You are certain that platinum can be mined here |
|||
match pdanger You are certain that damite can be mined here |
|||
match pdanger You are certain that lumium can be mined here |
|||
match pdanger You are certain that glaes can be mined here |
|||
match pdanger You are certain that silversteel can be mined here |
|||
match pdanger You are certain that kertig can be mined here |
|||
match pdanger You are certain that animite can be mined here |
|||
match pdanger You are certain that haralun can be mined here |
|||
match pdanger You are certain that muracite can be mined here |
|||
match pdanger You are certain that niello can be mined here |
|||
match pdanger You are certain that niniam can be mined here |
|||
match pdanger You are certain that orichalcum can be mined here |
|||
MATCH pdanger You are certain that tyrium can be mined here |
|||
MATCH pdanger You are certain that vardite can be mined here |
|||
MATCH pr Miners stand ready |
MATCH pr Miners stand ready |
||
MATCH %s Roundtime: |
MATCH %s Roundtime: |
||
put prospect |
put prospect |
||
MATCHWAIT |
MATCHWAIT |
||
</pre> |
|||
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. |
|||
<pre> |
|||
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 |
|||
</pre> |
|||
PLEASE NOTE I HAVE NOT TESTED |
|||
I am fairly certain of the accuracy/validity of my suggestions.<br> |
|||
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 [[User:Caraamon|Caraamon Makdasi]]<sup>([[User talk:Caraamon|talk]])</sup> 22:36, 23 June 2013 (UTC) |
Latest revision as of 10:24, 24 June 2013
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)