Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Showing off 2 new string related commands

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Arcade
View previous topic :: View next topic  
Author Message
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Mon Jun 19, 2006 7:31 am    Post subject: Showing off 2 new string related commands Reply with quote

The commands are
Code:
search string(start,ID1, ID2)
, and
Code:
trim string(ID,start,length)


Code:
search string(start,ID1, ID2)
start, is the position in the string ID1 that you want to start looking for string ID2.

Code:
trim string(ID,start,length)
ID is the string you want to trim, start is the position in the string that you want to start trimming, anything to the left of start will be deleted, or trimmed. Length is the size of the string you want to preserve, anything to the right of the number will be deleted.

The 2 commands in action:
Code:

$1="The dog jumped over the moon!"
$2="dog"
copystring(3,1) #copies 1st string into 3rd
trimstring(1,searchstring(1,1,2),stringlength(2)+7) #trims the string around dog jumped,
#the 1st string now contains the sentence "dog jumped"
showstringat(3,80,80) #shows the original string
showstringat(1,100,100) #shows the modifed string
showstringat(2,100,120) #shows the search string

The above code will produce this:


Expect these 2 new commands in the next release of Windows OHR, I am not sure about the DOS version though.

I am sure some of you will put these to a good use.
_________________
Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Jun 19, 2006 7:04 pm    Post subject: Re: Showing off 2 new string related commands Reply with quote

Ysoft_Entertainment wrote:

Code:
search string(start,ID1, ID2)
start, is the position in the string ID1 that you want to start looking for string ID2.

Code:
trim string(ID,start,length)
ID is the string you want to trim, start is the position in the string that you want to start trimming, anything to the left of start will be deleted, or trimmed. Length is the size of the string you want to preserve, anything to the right of the number will be deleted.


The argument order to search string is illogical. All other string commands have a string ID as the first command. Also, if start is the last argument, it can have a default value of 1. Sure, that's how QB does it... but QB doesn't make any sense! Don't want to pass on the horrors of QB to HS users.

If we want to get tricky, we could do some overloading and add "trim string (ID, length)" by defaulting last arg to -1 to signal overloaded usage, just like importglobals and the like. It adds functionality (or ease of use in this case), but I wonder if it ever confuses people.


Ysoft_Entertainment wrote:

Expect these 2 new commands in the next release of Windows OHR, I am not sure about the DOS version though.


Not DOS.

Ysoft_Entertainment wrote:

I am sure some of you will put these to a good use.


Oh, it was definitely missing :)
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Tue Jun 20, 2006 5:58 am    Post subject: Reply with quote

ok, I am not going to do anything with trim string, I think its fine the way it is, but I did fix the order of arguments in search string.

oh, and default values of start in both commands are 1, also default value of length in trim string is also 1(should this be 40?)
_________________
Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Arcade All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group