[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]  Converting ROM snipper to FUSS
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Converting ROM snipper to FUSS

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1 2  3  

Posted by Mopop   (115 posts)  [Biography] bio
Date Fri 16 Dec 2005 01:09 PM (UTC)  quote  ]

Amended on Fri 16 Dec 2005 01:18 PM (UTC) by Mopop

Message
Hello! I quite recently took the task of adding a ROM snippet to my FUSS mud. Everything is going well, though there are a few errors. I managed to fix a few errors on my own (woo-hoo). But some of the errors coming up on my compile, im not familiar with.

act_obj.c: In function `do_shoot':
act_obj.c:3348: parse error before '(' token
act_obj.c:3349: parse error before '||' token
act_obj.c:3378: warning: implicit declaration of function `check_improve'
act_obj.c:3302: warning: statement with no effect
act_obj.c:3348: warning: statement with no effect
act_obj.c: At top level:
act_obj.c:3429: parse error before '}' token
act_obj.c: In function `do_reload':
act_obj.c:3443: too many arguments to function `get_obj_carry'

Now I looked in the code, and found this piece here and edited it. I may not of edited right.

if( can_use_skill( ch, number_percent(  ), gsn_clip ) ) && IS_OBJ_STAT(gun,GUN_CLIP);
        ||( can_use_skill( ch, number_percent(  ), gsn_energy ) ) && IS_OBJ_STAT(gun,GUN_ENERGY)
        ||( can_use_skill( ch, number_percent(  ), gsn_shell ) ) && IS_OBJ_STAT(gun,GUN_SHELL)
        ||( can_use_skill( ch, number_percent(  ), gsn_fuel ) ) && IS_OBJ_STAT(gun,GUN_FUEL)
        ||( can_use_skill( ch, number_percent(  ), gsn_rocket ) ) && IS_OBJ_STAT(gun,GUN_ROCKET)

those are lines 3348-3352

here are 3429

if (recoil == 1)
        {
        send_to_char ("The recoil slows you down a bit.\n\r", ch);
        WAIT_STATE(ch,1 * PULSE_VIOLENCE);
        }
        if (recoil == 2)
        {
        send_to_char ("The recoil sends throws you off balance.\n\r", ch);
        WAIT_STATE(ch,2 * PULSE_VIOLENCE);
        }
        if (recoil == 3)
        {
        send_to_char ("The strong recoil almost numbs your arm.\n\r", ch);
        WAIT_STATE(ch,3 * PULSE_VIOLENCE);
        }
        if (recoil == 4)
        {
        send_to_char ("The recoil almost shatters your hand.\n\r", ch);
        WAIT_STATE(ch,4 * PULSE_VIOLENCE);
        }

        }
        }
}

I removed the double brackets near the bottom thinking that was the error and It only caused more errors! So Im not sure whats wrong with that part.

There are alot more errors but I want to tackle one at a time. Mainly alot of "implicit declaration of function" errors which I never had to tackle before. Also a few piecies of the snippet I'm not quite sure since its ROM. Thanks in advance, as always :)

[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #1 on Fri 16 Dec 2005 03:28 PM (UTC)  quote  ]
Message
if( can_use_skill( ch, number_percent(  ), gsn_clip ) ) && IS_OBJ_STAT(gun,GUN_CLIP);

Remove that semi-colon at the end. I have no idea why it's there, I don't think you can do that in an ifcheck. Also, does Smaug have IS_OBJ_STAT? I forget.

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #2 on Fri 16 Dec 2005 03:37 PM (UTC)  quote  ]
Message
It was used at IS_WEAPON_STAT and came up as an error. I checked the code for similar and saw IS_OBJ_STAT. Removed the ; and got

act_obj.c: In function `do_shoot':
act_obj.c:3348: parse error before '(' token
act_obj.c:3350: warning: suggest parentheses around && within ||
act_obj.c:3351: warning: suggest parentheses around && within ||
act_obj.c:3352: warning: suggest parentheses around && within ||
act_obj.c:3353: warning: suggest parentheses around && within ||
act_obj.c:3353: parse error before '{' token
act_obj.c:3378: warning: implicit declaration of function `check_improve'
act_obj.c:3302: warning: statement with no effect
act_obj.c: At top level:
act_obj.c:3429: parse error before '}' token

What do you mean it cant be done tho? Its suppose to check if they can use that type of gun. Im not sure how else to write it.
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #3 on Fri 16 Dec 2005 03:41 PM (UTC)  quote  ]

Amended on Fri 16 Dec 2005 04:05 PM (UTC) by Zeno

Message
I mean, I don't think you can use a semi-colon in an ifcheck.

Get rid of the first ) in the first line. It's closing the whole ifcheck.

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #4 on Fri 16 Dec 2005 03:56 PM (UTC)  quote  ]
Message
Should I get rid of it in every line?
bleh I hate all this ( ) stuff =P It seemed to cause more bugs tho -_- so weird.

i changed it to this

if( can_use_skill( ch, number_percent, gsn_clip ) ) && IS_OBJ_STAT(gun,GUN_CLIP)


and got this

act_obj.c:3348: warning: passing arg 2 of `can_use_skill' makes integer from pointer without a cast
act_obj.c:3348: parse error before '(' token
act_obj.c:3350: warning: suggest parentheses around && within ||
act_obj.c:3351: warning: suggest parentheses around && within ||
act_obj.c:3352: warning: suggest parentheses around && within ||
act_obj.c:3353: warning: suggest parentheses around && within ||
act_obj.c:3353: parse error before '{' token

So yeah, I dunno :P
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #5 on Fri 16 Dec 2005 03:59 PM (UTC)  quote  ]
Message
Just paste that whole block of code.

Seems like it's using can_use_skill wrong.

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #6 on Fri 16 Dec 2005 04:01 PM (UTC)  quote  ]
Message

 /* Do the character know how to handle a gun ? */
    for(number = 0 ; number < shots ; number = number + 1)
        {
        if( can_use_skill( ch, number_percent, gsn_clip ) ) && IS_OBJ_STAT(gun,GUN_CLIP)
        ||( can_use_skill( ch, number_percent(  ), gsn_energy ) ) && IS_OBJ_STAT(gun,GUN_ENERGY)
        ||( can_use_skill( ch, number_percent(  ), gsn_shell ) ) && IS_OBJ_STAT(gun,GUN_SHELL)
        ||( can_use_skill( ch, number_percent(  ), gsn_fuel ) ) && IS_OBJ_STAT(gun,GUN_FUEL)
        ||( can_use_skill( ch, number_percent(  ), gsn_rocket ) ) && IS_OBJ_STAT(gun,GUN_ROCKET)
        {
            obj_cast_spell( gun->value[3], gun->value[0], ch, victim, obj );
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #7 on Fri 16 Dec 2005 04:05 PM (UTC)  quote  ]
Message
Is that the original code? I don't even think that would compile anywhere. It closes the ifcheck off in the first line...

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #8 on Fri 16 Dec 2005 06:45 PM (UTC)  quote  ]
Message
Well no thats just the section for the check to see if they have that weapon skill, the rest is pretty long. Remember this is ROM and Im not really familiar with ROM and my Smaug skills arent as good, so its been tough trying to get the differences.
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #9 on Fri 16 Dec 2005 06:51 PM (UTC)  quote  ]
Message
Well yes I know it's Rom, but that doesn't matter. This is basic programming logic:
        if( can_use_skill( ch, number_percent, gsn_clip ) ) && IS_OBJ_STAT(gun,GUN_CLIP)

I highlighted where the two brackets are. As you can tell, it closes off the ifcheck. So then using && will cause an error.

It's really long? Are you saying that the bracket is closing off something else somewhere in the code?

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #10 on Fri 16 Dec 2005 06:55 PM (UTC)  quote  ]
Message
I thought you meant the whole snippet, Im not really good with the bracket and ( ) stuff, heh. So just remove the ( )?
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #11 on Fri 16 Dec 2005 07:01 PM (UTC)  quote  ]

Amended on Fri 16 Dec 2005 07:04 PM (UTC) by Nick Cash

Message
Simply put, you need a close bracket for each open bracket, and each function needs two brakcets (even if it has no parameters). The if check should look like this:

if(( can_use_skill( ch, number_percent(  ), gsn_clip ) && IS_OBJ_STAT(gun,GUN_CLIP))
        ||( can_use_skill( ch, number_percent(  ),gsn_energy ) && IS_OBJ_STAT(gun,GUN_ENERGY))
        ||( can_use_skill( ch, number_percent(  ), gsn_shell ) && IS_OBJ_STAT(gun,GUN_SHELL))
        ||( can_use_skill( ch, number_percent(  ), gsn_fuel ) && IS_OBJ_STAT(gun,GUN_FUEL))
        ||( can_use_skill( ch, number_percent(  ), gsn_rocket ) && IS_OBJ_STAT(gun,GUN_ROCKET)))

Thats also using the compilers suggestion of paren's around the vital parts.

Note the form. There is exactly one close paren for each open paren, and the last line has three closes, one which corrosponds to the if's open paren. You can use paren's to override precedence (like in algebra), which often makes things a little less confusing and avoids warnings with the compiler.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #12 on Fri 16 Dec 2005 07:10 PM (UTC)  quote  ]
Message
Well i fixed all the brackets like you showed me, and some reason it compiles more errors. This is so confusing -.-

act_obj.c: In function `do_shoot':
act_obj.c:3353: parse error before '{' token
act_obj.c:3373: parse error before "else"
act_obj.c:3378: warning: implicit declaration of function `check_improve'
act_obj.c:3262: warning: unused variable `recoil'
act_obj.c:3302: warning: statement with no effect
act_obj.c: At top level:
act_obj.c:3384: parse error before "if"
act_obj.c:3408: parse error before '->' token
act_obj.c:3413: parse error before '->' token
act_obj.c:3418: parse error before '->' token
act_obj.c:3423: parse error before '->' token
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio   Moderator
Date Reply #13 on Fri 16 Dec 2005 07:19 PM (UTC)  quote  ]
Message
Looks like you missed something like a bracket closing in the past. Check and make sure every bracket has a matching end bracket.

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

Posted by Mopop   (115 posts)  [Biography] bio
Date Reply #14 on Fri 16 Dec 2005 07:24 PM (UTC)  quote  ]
Message

||( can_use_skill( ch, number_percent( ), gsn_energy ) && IS_OBJ_STAT(gun,GUN_ENERGY)
        ||( can_use_skill( ch, number_percent( ), gsn_shell ) && IS_OBJ_STAT(gun,GUN_SHELL)
        ||( can_use_skill( ch, number_percent( ), gsn_fuel ) && IS_OBJ_STAT(gun,GUN_FUEL)
        ||( can_use_skill( ch, number_percent( ), gsn_rocket ) && IS_OBJ_STAT(gun,GUN_ROCKET)


I had a question, exactly what does the || do? because I dont see any mis placed things :-\
[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.


10,352 views.

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

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [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.

[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]    [Web site powered by FutureQuest.Net]