by Roody_Yogurt » Thu Apr 03, 2014 1:02 pm
So, an updated version of roodylib with the necessary message replacement calls is now up here (and will be in the next official release):
https://bitbucket.org/roody_yogurt/hugo ... ?at=master
Next is some code showing how to capitalize every first letter in a game where room names are all lowercase for extensions like CanGo. First, before roodylib.h is included, set the following:
Then add this to your game:
Code: Select all
replace NewRlibMessages(r, num, a, b)
{
select r
case &DescribePlace
{
select num
case 1
{
if not (FORMAT & DESCFORM_I) or (verbroutine ~= &MovePlayer and
verbroutine ~= &DoLookAround and a = location)
print "\n";
else
{
local col
col = display.cursor_column
if system(61) or not display.hasgraphics
--col
if col
"\n";
}
Font(BOLD_ON)
CapitalizeRoom(a)
! print capital a.name;
! Print ", in <something>" if necessary
if location = a and player not in a
{
if parent(player).prep
print ", "; parent(player).prep; " ";
elseif parent(player) is platform
print ", "; ON_WORD; " ";
else
print ", "; IN_WORD; " ";
print Art(parent(player))
}
print newline
Font(BOLD_OFF)
}
}
case &WriteStatus
{
if not location
print "\_";
elseif not light_source
print "\_In the dark";
else
{
print "\_";
CapitalizeRoom(location)
! print capital location.name;
}
}
case else : return false
return true ! this line is only reached if we replaced something
}
array roomname[100]
routine CapitalizeRoom(place)
{
text to roomname
print place.name;
text to 0
CapitalizeEveryFirstLetter(roomname)
StringPrint(roomname)
}
Of course, you could also just alter the messages so the first letters of rooms are *not* capitalized if that floats your boat. I took a look at book title capitalization rules, and it really seems like more of a hassle to code than it is worth. In a game where you really want room names to be *right*, it might be worth it to give those rooms an extra name property with the proper capitalization and alter the messages to print from the other property instead.
Also, you'll notice that my above code doesn't do anything about ", in the <parent> of player" text so if your game has stuff like that, you might have to alter the code to accommodate that to your tastes.
So, an updated version of roodylib with the necessary message replacement calls is now up here (and will be in the next official release):
[url]https://bitbucket.org/roody_yogurt/hugo-code-lab/src/7674b682f853b70dec8aa78e022b162db18f9d7a/roodylib/roodylib.h?at=master[/url]
Next is some code showing how to capitalize every first letter in a game where room names are all lowercase for extensions like CanGo. First, before roodylib.h is included, set the following:
[code]#set USE_STRING_MANIPULATION[/code]
Then add this to your game:
[code]replace NewRlibMessages(r, num, a, b)
{
select r
case &DescribePlace
{
select num
case 1
{
if not (FORMAT & DESCFORM_I) or (verbroutine ~= &MovePlayer and
verbroutine ~= &DoLookAround and a = location)
print "\n";
else
{
local col
col = display.cursor_column
if system(61) or not display.hasgraphics
--col
if col
"\n";
}
Font(BOLD_ON)
CapitalizeRoom(a)
! print capital a.name;
! Print ", in <something>" if necessary
if location = a and player not in a
{
if parent(player).prep
print ", "; parent(player).prep; " ";
elseif parent(player) is platform
print ", "; ON_WORD; " ";
else
print ", "; IN_WORD; " ";
print Art(parent(player))
}
print newline
Font(BOLD_OFF)
}
}
case &WriteStatus
{
if not location
print "\_";
elseif not light_source
print "\_In the dark";
else
{
print "\_";
CapitalizeRoom(location)
! print capital location.name;
}
}
case else : return false
return true ! this line is only reached if we replaced something
}
array roomname[100]
routine CapitalizeRoom(place)
{
text to roomname
print place.name;
text to 0
CapitalizeEveryFirstLetter(roomname)
StringPrint(roomname)
}[/code]
Of course, you could also just alter the messages so the first letters of rooms are *not* capitalized if that floats your boat. I took a look at book title capitalization rules, and it really seems like more of a hassle to code than it is worth. In a game where you really want room names to be *right*, it might be worth it to give those rooms an extra name property with the proper capitalization and alter the messages to print from the other property instead.
Also, you'll notice that my above code doesn't do anything about ", in the <parent> of player" text so if your game has stuff like that, you might have to alter the code to accommodate that to your tastes.