How to replace NewMessages

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to replace NewMessages

by Johnny » Sun Aug 15, 2010 7:18 am

You're welcome. Happy Hugo'ing!

by Bainespal » Sat Aug 14, 2010 6:33 am

Yes, that works. Thanks! :)

by Johnny » Thu Aug 12, 2010 3:02 pm

You want to do something like this:

Edit: Roody_Yogurt rools, I drool.

Code: Select all

replace NewMessages(r, num, a, b)
{
    select r

    case &CheckReach
    {
        select num
        case 3
        {
            !!! Your changes go here.
            return true
        }
    }

    return false
}

How to replace NewMessages

by Bainespal » 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.

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>
&#125;                                       ! exists for routine <r>
I'm trying to modify the third message for the CheckReach routine (here's the code from Message):

Code: Select all

	case &CheckReach
	&#123;
		select num
		case 1
		&#123;
			print "Except that "; The&#40;parent&#40;a&#41;&#41;; \
				MatchPlural&#40;parent&#40;a&#41;, "has", "have"&#41;; \
				" "; The&#40;a&#41;; "."
		&#125;
		case 2
		&#123;
			print "Except that "; The&#40;parent&#40;a&#41;&#41;; \
				MatchPlural&#40;parent&#40;a&#41;, "doesn't", "don't"&#41;; \
				" want to give "; The&#40;player, true&#41;; \
				" "; The&#40;a&#41;; "."
		&#125;
		case 3&#58;  print CThe&#40;player&#41;; " can't reach "; The&#40;a&#41;; \
				" from "; The&#40;parent&#40;player&#41;&#41;; "."
	&#125;
I want to replace case 3, so I tried

Code: Select all

replace NewMessages&#40;CheckReach, 3&#41;
  &#123;  &#91;My modification here.&#93;  &#125;
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.

Top