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

Gammon Software Solutions 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?
(New message)
Subject: Calling a variable from another function
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Sun 14 Sep 2003 07:40 AM (UTC)  quote  ]
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

Posted by Boborak   USA  (228 posts)  [Biography] bio
Date Sun 14 Sep 2003 03:56 AM (UTC)  quote  ]
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,867 posts)  [Biography] bio   Moderator
Date Sat 13 Sep 2003 05:56 PM (UTC)  quote  ]
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 Greven   Canada  (835 posts)  [Biography] bio
Date Sat 13 Sep 2003 09:18 AM (UTC)  quote  ]
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,867 posts)  [Biography] bio   Moderator
Date Fri 12 Sep 2003 11:02 PM (UTC)  quote  ]

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 Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Fri 12 Sep 2003 10:23 PM (UTC)  quote  ]
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,867 posts)  [Biography] bio   Moderator
Date Fri 12 Sep 2003 09:49 PM (UTC)  quote  ]
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

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.


2,986 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]