Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Making a new ifcheck; "fighting"?

Making a new ifcheck; "fighting"?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zeno   USA  (2,871 posts)  Bio
Date Tue 14 Mar 2006 05:27 AM (UTC)
Message
I'm looking to add an ifcheck that has this prog syntax:
if fighting($n) == $t

Checks if $n is fighting $t.

Is there a way to code this in without changing the entire mprog_do_ifcheck header and body? Since it seems to only have two CHAR_DATA vars.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Tue 14 Mar 2006 05:31 AM (UTC)
Message
I must be confused -- why do you have to change the entire header and body, and not just add a normal if-check block as for any other if-check?

Can't you just make an ifcheck for fighting that takes its argument as a string, gets the character, then compares ch->fighting->name to the right-hand side, and then you're done?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Tue 14 Mar 2006 05:39 AM (UTC)

Amended on Tue 14 Mar 2006 05:42 AM (UTC) by Zeno

Message
Maybe I'm the one confused?

Here's what I think. The header only passes in two CHAR_DATA's (besides random), and I need a third one. One is used for the prog initiator (in this case, it's the supermob since this is an obj), another is used for the victim checked in the line. This is what I have currently:
if fighting($n)

That checks if the initiator is fighting $n. That's two variables used. I need a third one for the victim since the supermob has already taken one variable.

As for a string, it wouldn't work. We are using $n, $t etc here. Not strings like "Zeno". Doing this would be pointless:
if fighting($n) == Zeno

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Tue 14 Mar 2006 06:19 AM (UTC)
Message
As a side note, isn't $n the initiator already? Wouldn't "if fighting($n)" be a non-question, since $n is never fighting $n?


Anyhow --

I think you are right, the problem is that the right-hand side of if-checks do not seem to take anything but strings and numbers. One thing you could try doing is for the fighting ifcheck, before comparing fighting($n) to the rhs, you would pass rhs through mprog_translate. That should get $t converted to a string. Then, the fighting($n) ifcheck can compare $n->fighting->name to the string that $t was converted from.

I'm saying all this on the fly, I have not actually tested it... it's just from my memory of how the horror-that-is-MUDprog (may it forever burn in hell) works. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Tue 14 Mar 2006 06:32 AM (UTC)
Message
Quote:
As a side note, isn't $n the initiator already? Wouldn't "if fighting($n)" be a non-question, since $n is never fighting $n?

In this case, the prog was on a speech trigger. So the one who said the trigger is $n. The mob who has the prog is the one it's checking against. So no.

I'll check into some more tomorrow.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,916 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.