[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Calling a variable from another function
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Calling a variable from another function

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


Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] 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
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Boborak   USA  (228 posts)  [Biography] 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.
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] 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.


5,532 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]