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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Simple question...I think!

Simple question...I think!

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


Posted by Jmont   (4 posts)  [Biography] bio
Date Wed 05 Aug 2009 12:19 AM (UTC)
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
Date Reply #1 on Wed 05 Aug 2009 12:50 AM (UTC)
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)
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
Date Reply #3 on Wed 05 Aug 2009 12:56 AM (UTC)
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)
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
Date Reply #5 on Wed 05 Aug 2009 01:29 AM (UTC)

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)
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
Date Reply #7 on Wed 05 Aug 2009 01:55 AM (UTC)
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.


18,816 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 HostDash]