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
➜ Calling a variable from another function
Calling a variable from another function
|
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
| Fri 12 Sep 2003 09:49 PM (UTC) |
Message
| I made a new function in fight.c, and I want to use the variable dam in it, but I don't want to redefine it. How would I call it from ch_ret one_hit ? |
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 Fri 12 Sep 2003 10:23 PM (UTC) |
Message
| Pass it as an argument.
eg.
void my_new_function (int dam)
{
// blah blah
}
Then in one_hit:
my_new_function (dam);
You may need to pass other arguments as well to be useful.
eg.
void my_new_function ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int dam)
{
// blah blah
}
Then in one_hit:
my_new_function (ch, victim, dt, dam);
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #2 on Fri 12 Sep 2003 11:02 PM (UTC) Amended on Sat 13 Sep 2003 12:05 AM (UTC) by Zeno
|
Message
| Ok, I think it worked. But, whats dt? I looked in fight.c and couldn't find what it was defined as. I saw "dt = TYPE_HIT;". I'm still looking over stuff right now though.
[EDIT] So far the function is working like I wanted it to. I'd just like to know things when I use them. :)
[EDIT2] Also, damage doesn't seem to be going over 30000, which is sh_int. Whats affecting this? I want damage to go higher, but I'm not sure what dt and stuff has to do. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #3 on Sat 13 Sep 2003 09:18 AM (UTC) |
Message
| DT is short for damage type, it refers to, depending where, the gsn of the shill that is being used, or sometime the type of weapon for a normal attack. If the damage is not going above 30k, ever, then it being restricted somewhere, you might look in the damage functions to make sure that the variable used for damage is not a sh_int, as well as not coded restrictions. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #4 on Sat 13 Sep 2003 05:56 PM (UTC) |
Message
| I've looked over fight.c and I'm not sure what to change. There's a lot of damage functions, and I've already changed dam to int, but whenever I do over 31000 damage (I think) It goes to 0, or 1. Its a big list to look over, so I'll keep searching. But if someone could be more specific, it would help. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Boborak
USA (228 posts) Bio
|
Date
| Reply #5 on Sun 14 Sep 2003 03:56 AM (UTC) |
Message
| Sounds like there's a variable somewhere that is set to sh_int. That would limit that particular variable to 32767 (for most people anyway). I don't believe anything in one_hit() is set to sh_int but you may have something in your new function that is. If you do happen to have a variable set to sh_int, change it to int and the problem with dam becoming 0 or 1 should go away. | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #6 on Sun 14 Sep 2003 07:40 AM (UTC) |
Message
| Yeah, I know, but the problem is, I don't know what function it is. My new fuction is fine, everything's int or higher. This problem existed before the new fuction was put in. A while back, dam was sh_int, but I already changed that to int. |
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.
18,880 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top