| !\--------------------------------------------------------------------------- | |
| STRFNC.H V1.50 Demo by Jason Peter Brown | |
| for use with Hugo v2.4+ and STRFNC.H | |
| ---------------------------------------------------------------------------\! | |
| ! Uncomment the following to use a precompiled version of the Hugo Library: | |
| #set PRECOMPILED_LIBRARY | |
| ! Uncomment the following to include the HugoFix Debugging Library: | |
| ! #set DEBUG | |
| ! Uncomment the following to include verb stub routines: | |
| ! #set VERBSTUBS | |
| #include "grammar.g" ! grammar must come first | |
| #ifset PRECOMPILED_LIBRARY | |
| #link "hugolib.hlb" | |
| #endif | |
| #ifclear PRECOMPILED_LIBRARY | |
| #include "hugolib.h" | |
| #endif | |
| #include "strfnc.h" | |
| routine init | |
| { | |
| counter = -1 | |
| STATUSTYPE = 0 ! score/turns | |
| TEXTCOLOR = DEF_FOREGROUND | |
| BGCOLOR = DEF_BACKGROUND | |
| SL_TEXTCOLOR = BRIGHT_WHITE | |
| SL_BGCOLOR = BLUE | |
| prompt = ">" | |
| color TEXTCOLOR, BGCOLOR | |
| cls | |
| print BANNER | |
| player = you ! player initialization | |
| location = emptyroom | |
| old_location = location | |
| move player to location | |
| FindLight(location) | |
| DescribePlace(location) | |
| location is visited | |
| CalculateHolding(player) | |
| #ifset USE_PLURAL_OBJECTS | |
| InitPluralObjects | |
| #endif | |
| } | |
| #ifset PRECOMPILED_LIBRARY | |
| replace main | |
| { | |
| #endif | |
| #ifclear PRECOMPILED_LIBRARY | |
| routine main | |
| { | |
| #endif | |
| local x | |
| PrintStatusLine | |
| !!! DEMO CODE Begins | |
| print "\n\BThis is an example of the RIGHT$ routine:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Right$(\"LeftMiddleRight\",5) : "; | |
| x = right$("LeftMiddleRight", 5) | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the RIGHT$ routine with replace:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Replacement string : \"*****\"" | |
| print "Right$(\"LeftMiddleRight\",5,\"*****\") : "; | |
| x = right$("LeftMiddleRight", 5, "*****") | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the LEFT$ routine:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Left$(\"LeftMiddleRight\",4) : "; | |
| x = left$("LeftMiddleRight", 4) | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the LEFT$ routine with replace:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Replacement string : \"****\"" | |
| print "Left$(\"LeftMiddleRight\",4,\"****\") : "; | |
| x = left$("LeftMiddleRight", 4, "****") | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the MID$ routine:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Mid$(\"LeftMiddleRight\",4,6) : "; | |
| x = mid$("LeftMiddleRight", 4, 6) | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the MID$ routine with replace:\b" | |
| print "Original string : \"LeftMiddleRight\"" | |
| print "Replacement String : \"******\"" | |
| print "Mid$(\"LeftMiddleRight\",10,4,\"******\") : "; | |
| x = mid$("LeftMiddleRight", 4,6, "******") | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the ADD$ routine:\b" | |
| print "First string : \"Hello, \"" | |
| print "Second String : \"Goodbye.\"" | |
| print "Add$(\"Hello, \",\"Goodbye.\") : "; | |
| x = add$("Hello, ", "Goodbye.") | |
| print "\"";stringprint(x);"\"" | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the SEARCH$ routine:\b" | |
| print "Source string : \"Sample Search String.\"" | |
| print "Search string : \"a\"" | |
| x = search$("Sample Search String.", "a") | |
| if not x | |
| { | |
| print "Search string not found." | |
| } | |
| else | |
| { | |
| print "Search text begins at position ";number (x);"" | |
| } | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the SEARCH$ routine with offset:\b" | |
| print "Source string : \"Sample Search String.\"" | |
| print "Search string : \"a\"" | |
| print "Search offset : 5" | |
| x = search$("Sample Search String.", "a", 5) | |
| if not x | |
| { | |
| print "Search string not found." | |
| } | |
| else | |
| { | |
| print "Search text begins at position ";number (x);"" | |
| } | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the PRINTCENTER() routine:\b" | |
| print "PrintCenter(string) :" | |
| PrintCenter("Centered Text.") | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| print "\n\BThis is an example of the PRINTRIGHT() routine:\b" | |
| print "PrintRight(string) : " | |
| PrintRight("Right Justified Text.") | |
| print "\n[PRESS ANY KEY...]" | |
| pause | |
| "\IThis concludes the strfnc.h demo.\i" | |
| pause | |
| return true | |
| !!! DEMO CODE Ends | |
| } | |
| character you "you" | |
| { | |
| nouns "me", "myself" | |
| capacity 100 | |
| long_desc {"Looking good."} | |
| is plural ! for matching first-person verbs | |
| is hidden ! for location descriptions | |
| } | |
| room emptyroom "[STRFNC.H] Seven New Hugo String Functions V1.5 by Jason Peter Brown." | |
| { | |
| } | |
Xet Storage Details
- Size:
- 5.81 kB
- Xet hash:
- f9b7ecec7805f55c86c541026d32cb8b0c533a128e4193cbdb3a80bf4790670f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.