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 ➜ Just a little help with SMAUG

Just a little help with SMAUG

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


Pages: 1  2  3 4  

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #30 on Thu 23 Mar 2006 05:10 AM (UTC)
Message
Taking my example, buggy, program:


int main ()
  {  // <------ "A"
  printf ("hello, world\n");
  return 0;

  {  // <------ "B"
  }  // <------ "C"


If I edit this in vi and put the cursor on the "{" in line "A", and hit the % symbol, the cursor doesn't move. This is wrong because I expect it to move to the end of the function.

However if I move the cursor to where I believe the end of the function to be (line C) and hit % the cursor jumps back to line B. This is where the extra bracket is.

(Almost) every C program is going to consist of functions which generally look like this:


void function_name (arguments)
  {

  ..... body of function here .....

  }

void some_other_function (arguments)
  {

  ..... body of function here .....

  }


The word "void" in the example above will be the function return value, which might be "int" or something else (like "bool").

However the basic structure is the same.

You should be able to spot them because of indentation, comments, blank lines, and general source structure. Now in each case you should be able to put the cursor on the first "{" and hit "%" (in vi) and the cursor will move to the final "}" symbol. (And vice-versa, put the cursor on the final "}" and hit "%" and it will move to the first "{").

If that doesn't happen, you have found the function with the problem with brackets.




- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #31 on Thu 23 Mar 2006 06:52 PM (UTC)
Message
the problem is i did that all the way through, with lining up the braces, :syntax enable, etc, but i didnt find anything, and i am highlighting a brace before i use the '%' command
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #32 on Thu 23 Mar 2006 09:57 PM (UTC)
Message
Another possibility is a misplaced comment. In this example:


int main ()
  {
  printf ("hello, world\n");
  return 0;

 /*
 }
  */


If I put the cursor on the final "}" and hit % it moves to the first "{".

However the compiler doesn't see it that way because the "}" is commented out.

All I can suggest is go back to the working version, and slowly add your changes back in. The block of changes that causes the message is the cause of the problem. Look carefully in that for a misplaced comment or extra or missing brace.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #33 on Thu 23 Mar 2006 11:50 PM (UTC)
Message
thank you, um but back to my question on how to show the damage during a battle, how would i do that.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #34 on Fri 24 Mar 2006 12:22 AM (UTC)
Message
Look in fight.c. The function damage is what deals the damage. It computes the final number. Find the part where it deals the damage. Add a function call to print a string, formatted however you like it. Voila, all done.

But again, may I suggest that you fix your brace problem before moving on to other things? By adding changes without making sure things work first, you run a very strong risk of breaking things even more and having a hard time of fixing it. And now, you have an especially pressing case, because your code doesn't even compile.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #35 on Fri 24 Mar 2006 12:47 AM (UTC)

Amended on Fri 24 Mar 2006 12:52 AM (UTC) by Killfoobar

Message
i fixed the brace thing, but now i have a problem with player.c

void do_inventory( CHAR_DATA *ch, char *argument )
{
    set_char_color( AT_RED, ch );
    send_to_char( "You are carrying:\n\r", ch );
    show_list_to_char( ch->first_carrying, ch, TRUE, TRUE, eItemDrop ); /* the compiler says for this line says eItemDrop, first time it is declared, and it says too many arguments for the function show_list_to_char */
    return;
}
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #36 on Fri 24 Mar 2006 12:51 AM (UTC)
Message
That doesn't look like it's stock. Where did eItemDrop originate from? It's not declared in the function.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #37 on Fri 24 Mar 2006 12:52 AM (UTC)
Message
its from the mxp version
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #38 on Fri 24 Mar 2006 12:57 AM (UTC)
Message
The MXP version compiles just fine, you must have changed something to break it. What did you change in this file?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #39 on Fri 24 Mar 2006 01:31 AM (UTC)
Message
Yes, that isn't stock MXP.
void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing, const int iDefaultAction )

As you can tell, the function header there is fine and you shouldn't be getting the second error you have.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #40 on Fri 24 Mar 2006 05:18 AM (UTC)
Message
Quote:

um but back to my question on how to show the damage during a battle, how would i do that.



Have you read this post? I think it covers that subject:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=289

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #41 on Mon 27 Mar 2006 11:34 PM (UTC)

Amended on Mon 27 Mar 2006 11:35 PM (UTC) by Killfoobar

Message
ok now it is giving me undefined _crypt, undefined _RENAME, and undefinded _bigregex errors after everything is made into the .o files.
And yes i went into the makefile file, and made the adjustments the comments suggested that i do.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #42 on Tue 28 Mar 2006 01:40 AM (UTC)
Message
When you make the makefile adjustments, you need to make clean and then make again.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Killfoobar   USA  (27 posts)  Bio
Date Reply #43 on Fri 31 Mar 2006 03:06 PM (UTC)

Amended on Fri 31 Mar 2006 03:35 PM (UTC) by Killfoobar

Message
i did that, but it still is giving me the same error messages _re_exec, _RENAME, and _crypt
it says that they are undefined refrences
Top

Posted by Gatewaysysop2   USA  (146 posts)  Bio
Date Reply #44 on Sat 01 Apr 2006 02:03 AM (UTC)
Message
Maybe post what your makefile looks like? That could possibly help.


"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence
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.


109,417 views.

This is page 3, subject is 4 pages long:  [Previous page]  1  2  3 4  [Next page]

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.