[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]  Anyone wanna help?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Anyone wanna help?

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


Posted by Zunit1920   (10 posts)  [Biography] bio
Date Tue 13 Dec 2005 10:12 PM (UTC)  quote  ]
Message
Ok here the problem i get this error when i try to compile my mud:

act_comm.c: In function `do_teach':
act_comm.c:1220: warning: `vch' might be used uninitialized in this function



Code refers to this:
CHAR_DATA *vch;

and it is used here:

if( is_android( vch ) || is_superandroid( vch ) || is_bio( vch ) )
{
ch_printf(ch, "Androids can't learn this way.\n\r");
return;
}
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #1 on Tue 13 Dec 2005 10:21 PM (UTC)  quote  ]
Message
It's not an error, it's a warning. It shouldn't prevent a compile.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Zunit1920   (10 posts)  [Biography] bio
Date Reply #2 on Tue 13 Dec 2005 10:37 PM (UTC)  quote  ]
Message
Ok sry it wasnt because of that...

It was because of this

if( IS_NPC( vch ) )
{
ch_printf( ch, "Not on NPC's.\n\r" );
return;
}

But if i just ignore the warning and i use the skill it crashes the mud:/
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #3 on Tue 13 Dec 2005 10:41 PM (UTC)  quote  ]
Message
Well, just like the warning says. The variable may not be uninitialized. Which means vch may be nothing. You have to define it.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Zunit1920   (10 posts)  [Biography] bio
Date Reply #4 on Tue 13 Dec 2005 10:42 PM (UTC)  quote  ]
Message
right now its CHAR_DATA *vch;

Even when i put CHAR_DATA *vch = NULL; it crashes idk what to put instead of NULL
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #5 on Tue 13 Dec 2005 10:43 PM (UTC)  quote  ]
Message
That's declaring it. You need to make vch something. Like, who it is. I don't know what you expect to do, so I can't really suggest what to do.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Zunit1920   (10 posts)  [Biography] bio
Date Reply #6 on Tue 13 Dec 2005 11:07 PM (UTC)  quote  ]

Amended on Tue 13 Dec 2005 11:08 PM (UTC) by Zunit1920

Message
The command i created was do_teach


And all i want is if statement to do is check if its a computer (meaning not a player) and if it is a computer say not on npc's


vch is used also with the is_android(vch) and all that from earlier

You have any idea of what to put intead of NULL?
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Reply #7 on Tue 13 Dec 2005 11:23 PM (UTC)  quote  ]
Message
Yes, but you said "check if its...". I still don't know enough. What is "it"? Look over other functions like do_consider, maybe?

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.


1,308 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]