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
➜ Displaying variable gains
Displaying variable gains
|
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
| Sat 30 Aug 2003 06:35 PM (UTC) |
Message
| I've made a new number variable for PCs, and it can be gained sometimes while fighting, or other things. I was wondering, how would I display the increase of the value? Such as "The gods reward you with %d points". I'd have to make a function in fight.c probably, and I've been working on it, but haven't gotten far. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 30 Aug 2003 09:28 PM (UTC) |
Message
| Have you been reading the recent posts by David B? He is doing the same thing. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #2 on Sat 30 Aug 2003 10:13 PM (UTC) |
Message
| Well, thats with MUSHclient, so its not really what I'm looking for, but I'll look it over and see if I can work it out. Still, any help I would appreciate. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 31 Aug 2003 12:02 AM (UTC) |
Message
| Sorry, didn't read the topic heading. :)
One approach would be to have a function to increment the variable rather than doing it directly, and whenever it is called, you could tell the player.
However if that happened too often, you could have two variables, like this:
int xxx; // the variable xxx
int xxx_reported; // what we last told him
From time to time (eg. when you check for hunger) you could compare the two, and if they differ tell the player he has received the difference, like this:
if (xxx_reported < xxx)
{
SendToPlayer (p, "you are rewarded with %i xxx", xxx - xxx_reported);
xxx_reported = xxx;
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #4 on Sun 31 Aug 2003 03:00 AM (UTC) Amended on Sun 31 Aug 2003 05:07 AM (UTC) by Zeno
|
Message
| Actually Nick, that post that David made helped out. I made a new function, with three variables, old and new, and had them diff. Which is what you also suggested. Worked fine. Thanks. |
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.
9,315 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top