[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]  Simple question...I think!
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Simple question...I think!

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


Posted by Jmont   (4 posts)  [Biography] bio
Date Wed 05 Aug 2009 12:19 AM (UTC)  quote  ]
Message
Alright I'm trying to get rid of carrying weight. So I have been getting rid of any instance of can_carry_w like so...


if( char_died( ch )
                   ||ch->carry_number >= can_carry_n( ch )
                   || ch->carry_weight >= can_carry_w( ch ) || ( number && cnt >= number ) )
                   {         
                  if( IS_SET( sysdata.save_flags, SV_GET ) && !char_died( ch ) )
                     save_char_obj( ch );
                  return;


Now when I delete this line

|| ch->carry_weight >= can_carry_w( ch ) || ( number && cnt >= number ) )


I get this error

  Compiling o/act_obj.o....
act_obj.c: In function `void do_get(CHAR_DATA*, const char*)':
act_obj.c:300: error: expected `)' before '{' token
act_obj.c:305: error: expected primary-expression before '}' token
act_obj.c:305: error: expected `;' before '}' token


But I if I add the line back in then everything is all OK. I'm sure I'm missing something simple here but I'm lost for words. If anyone can explain to me whats wrong, or even point me to a tutorial related to my error that would be awesome...I am eager to learn and create.

Thanks everyone!
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #1 on Wed 05 Aug 2009 12:50 AM (UTC)  quote  ]
Message
You're deleting too many parenthesis, as the error says.

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

Posted by Jmont   (4 posts)  [Biography] bio
Date Reply #2 on Wed 05 Aug 2009 12:55 AM (UTC)  quote  ]
Message
Hrm but it doesn't look like I need any parenthesis. Unless I'm wrong, which I have to be if I getting errors.


if( char_died( ch )
                   ||ch->carry_number >= can_carry_n( ch )
                   {         
                  if( IS_SET( sysdata.save_flags, SV_GET ) && !char_died( ch ) )
                     save_char_obj( ch );
                  return;
                  }
            }
         }


This is what it looks like when I take that line out. I don't really see what needs a parenthesis though ;_; Also what does the || mean?! It's been awhile since I took any programming classes.

Thanks Zeno
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #3 on Wed 05 Aug 2009 12:56 AM (UTC)  quote  ]
Message
The parenthesis before char_died is where you're missing the matching parenthesis.

|| is an or.

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

Posted by Jmont   (4 posts)  [Biography] bio
Date Reply #4 on Wed 05 Aug 2009 12:58 AM (UTC)  quote  ]
Message
Yeah I just noticed the missing parenthesis I didn't know it was one big IF statement. OK one last questions and I should be done with this one, what exactly Is this IF statement saying and doing?

Thanks again Zeno :D
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #5 on Wed 05 Aug 2009 01:29 AM (UTC)  quote  ]

Amended on Wed 05 Aug 2009 01:30 AM (UTC) by Zeno

Message
IF char has died OR char is carrying equal or greater than their max number of items OR char is carrying equal OR greater than their max weight OR ???, THEN IF the config is on for saving on get AND the char hasn't died, THEN save the char.

I don't know what the ??? is because I don't know what number or cnt is.

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

Posted by Jmont   (4 posts)  [Biography] bio
Date Reply #6 on Wed 05 Aug 2009 01:37 AM (UTC)  quote  ]
Message
This might be sound dumb but I thought saving was taken care of somewhere else? Is this just to make sure you don't get an item and lose it?
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #7 on Wed 05 Aug 2009 01:55 AM (UTC)  quote  ]
Message
Saving happens in many places. In this case, it is to save your char when you pick up an item.

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,756 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]