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 ➜ Not sure how to make this work

Not sure how to make this work

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


Posted by Gtr   (38 posts)  Bio
Date Sat 19 Jun 2004 10:06 AM (UTC)

Amended on Sat 19 Jun 2004 11:43 AM (UTC) by Gtr

Message
I'm trying to use:

if ( ( obj = get_eq_char( ch, arg1 ) ) == NULL )

I'm aware thats wrong, "warning: passing arg 2 of `get_eq_char' makes integer from pointer without a cast ". told me so heh. I was wondering if anyone knew how I could get this to work correctly?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Sat 19 Jun 2004 05:31 PM (UTC)
Message
Yes, the second argument, what you have as "argument" needs to be one of the defined wear locations, usually of the format "WEAR_*", like " WEAR_DUAL_WIELD", try one of those.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #2 on Sat 19 Jun 2004 09:32 PM (UTC)
Message
Or if you are doing it with user input I think you need to make it a number, in which it would be atoi( arg1 ) or something such as that.

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Sun 20 Jun 2004 02:51 AM (UTC)
Message
It may be more complicated than a simple atoi, because you might be trying to convert e.g. "body" to WEAR_BODY - atoi("body") will return 0. I'd imagine that there already is a routine written for this (check oset wear, or something like that) but if not it's fairly straightforward to write.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Gtr   (38 posts)  Bio
Date Reply #4 on Sun 20 Jun 2004 03:10 AM (UTC)
Message
Basicly I'm trying to get it to check if the charecter is wearing what the argument says. I'm sure theres a simple way to go about this, thanks for helping so far, I think I'll check out do_remove. See if maby that can help.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #5 on Sun 20 Jun 2004 03:21 AM (UTC)
Message
The function get_eq_char() is used for determining what equipment is at a particular location (represented by an integer), not if the argument is worn the player. I'd suggest looking at do_remove as you said, or the mud progs that check is_worn or something like that. In any case it should be a simple linear search over ch->first_carrying to ch->last_carrying, making sure the wearloc is not -1.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Gtr   (38 posts)  Bio
Date Reply #6 on Sun 20 Jun 2004 03:45 AM (UTC)
Message
Heh, I'm getting better and better at this coding thing, guess I just needed to spend a few hours not doing it. Figured out how, and thanks for the help guys.
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.


21,405 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.