How to replace NewMessages
Posted: Thu Aug 12, 2010 7:54 am
In hugolib.h, the NewMessages routine appears to be a stub intended to be replaced in the game code so that the user can customize specific parser messages.
I'm trying to modify the third message for the CheckReach routine (here's the code from Message):
I want to replace case 3, so I tried
in my code, but I get errors, regardless as to whether I try "NewMessages(CheckReach, 3)" or "NewMessages(&CheckReach, 3)".
I actually haven't tried to create a different message in place of the library message yet, because I haven't figured out how to do what I want it to (de-capitalize room names). But I can't experiment to try to do that until I can successfully replace the message.
Code: Select all
routine NewMessages(r, num, a, b) ! The NewMessages routine may be
{ ! replaced, and should return true
return false ! if a replacement message <num>
} ! exists for routine <r>
Code: Select all
case &CheckReach
{
select num
case 1
{
print "Except that "; The(parent(a)); \
MatchPlural(parent(a), "has", "have"); \
" "; The(a); "."
}
case 2
{
print "Except that "; The(parent(a)); \
MatchPlural(parent(a), "doesn't", "don't"); \
" want to give "; The(player, true); \
" "; The(a); "."
}
case 3: print CThe(player); " can't reach "; The(a); \
" from "; The(parent(player)); "."
}
Code: Select all
replace NewMessages(CheckReach, 3)
{ [My modification here.] }
I actually haven't tried to create a different message in place of the library message yet, because I haven't figured out how to do what I want it to (de-capitalize room names). But I can't experiment to try to do that until I can successfully replace the message.