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 ➜ A few questions.

A few questions.

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


Pages: 1  2  3 4  5  6  

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #30 on Mon 02 May 2005 05:35 PM (UTC)
Message
Make sure you use the code tags so it's easier to read. You need a return in parts where you want the code to stop, say after the "You do not have an axe".

The random number check is used much through the code. It's called rand_num or something of the sort.

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

Posted by Longbow   (102 posts)  Bio
Date Reply #31 on Mon 02 May 2005 05:54 PM (UTC)
Message
Ok, what do you mean by code tags? And what does the rand_num have to do with it? I'm still pretty new to coding, though I've learned a lot.



Thanks and Godbless,
Longbow
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #32 on Mon 02 May 2005 05:59 PM (UTC)

Amended on Mon 02 May 2005 06:00 PM (UTC) by Zeno

Message
Code tags, on the forums: [ code ] (no spaces)
See: http://www.gammon.com.au/forum/bbforumcode.php

Well you said dice sequence. What do you mean by that?

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

Posted by Longbow   (102 posts)  Bio
Date Reply #33 on Mon 02 May 2005 08:57 PM (UTC)
Message
Ahhhh, now I understand. I want a dice sequence such as if it equals 1 something happens, and 2 then something else happens(or the same, it could be a range), etc.


Thanks
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #34 on Mon 02 May 2005 09:47 PM (UTC)
Message
How do you want the dice to be based? Random?

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

Posted by Longbow   (102 posts)  Bio
Date Reply #35 on Mon 02 May 2005 09:55 PM (UTC)
Message
Yes, random please. I intend to use it to determine if a skill is successful by if the dice is such and such then such and such happens.
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #36 on Tue 03 May 2005 12:18 AM (UTC)
Message
Here are a few bits of information you might need, number_range is what you want to use to determine a number value between 2 numbers. learn_from_failure and learn_from_sucess are 2 other functions you might like to use. Grep them out to see how to use them, Your on the right track so far.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #37 on Tue 03 May 2005 12:43 AM (UTC)

Amended on Tue 03 May 2005 12:44 AM (UTC) by Zeno

Message
Ah yes, that's what its called. So you can do something like this. Declare a variable (lets call it rand). Then do something like this:
rand = number_range( 1, 3 )

Then do a case:
switch(rand)
case 1:
  do_stuff_here
  break;
case 2:
  do_more_here
  break;

And so on.

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

Posted by Txzeenath   USA  (54 posts)  Bio
Date Reply #38 on Tue 03 May 2005 07:29 PM (UTC)
Message
Ahh my favorite Haha.. I am very ... protestant... against certainty in a mud world.. I've got number_range cases everywhere.


And yes.. that's perfect.. but you might want to add a default: case there just incase something very weird happens that causes "rand" to become corrupted/changed
A default in a switch will be used any time nothing else matches.

default:
//something generic happens
break;

Darkness comes along thy path, searching, wanting, calling wrath,
shadows awaken, release the light, one and only.. here to fight,
challenge the darkness, the shadows they call, hunting the living,
more and all. Roaring thunder, full of hate, a single bound, seals
your fate.

-Txzeenath

telnet://divineright.org:8088
Alumuble Arda -
*Player owned shops, clans, and housing
*Multiclass & Stat training
*Random mob name generation implemented and Overland mapping.
*Realistic equipment statistics
*Interactive enviroment(weather/sectors)
*Weapon sheaths(scabbards), Throwing weapons
*Automatic crash recovery, saving, and reporting without disconnecting
*Fully customizeable color, Automapper, "Smart" mobiles, Hiscore tables, and more!

Currently running AGE v1.9.6(Originated and modified from Smaug 1.4a)
Top

Posted by Longbow   (102 posts)  Bio
Date Reply #39 on Wed 04 May 2005 09:51 PM (UTC)
Message
Ok, unrelated problem but still critical enough for me to post it here:

I noticed Smaug 1.4a has the trip code in skills.c but I have been unable to add it. I tried and I keep getting these errors on make:

skills.c:3063: error: conflicting types for 'do_trip'
mud.h:4088: error: previous declaration of 'do_trip'

I changed the variable from void trip to void do_trip when I set it in mud.h and db.c and tables.c. What would cause this problem?


Thanks and Godbless,
Longbow
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #40 on Wed 04 May 2005 10:48 PM (UTC)
Message
Well the trip function is for mobs to use. What you want to do is create a new function, do_trip for the trip skill, that has checks etc and calls the trip function.

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

Posted by Longbow   (102 posts)  Bio
Date Reply #41 on Wed 04 May 2005 11:33 PM (UTC)
Message
So the only thing I need to do is add a new line in skills.c called void do_trip and paste the code for trip under it?

Thanks and Godbless,
Longbow
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #42 on Wed 04 May 2005 11:59 PM (UTC)
Message
No, don't copy it. Just add a few checks (with skill percent etc, like the other skills) and then call the function.

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

Posted by Longbow   (102 posts)  Bio
Date Reply #43 on Mon 09 May 2005 11:04 PM (UTC)
Message
Ok, suddenly I cannot see action descs and the like(ie, if something happens in the room a blank black line appears) and it is messing up my MUD. I first noticed it after I put in the bank code located at AFKmud's homepage(www.afkmud.com) and it is driving me up the wall. What might cause this? I'd rather not go back and delete the bank code(took a lot of time to put in) but rather I'd like to just fix the problem. Any ideas?

Thanks and Godbless,
Longbow
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #44 on Tue 10 May 2005 09:04 PM (UTC)
Message
Sounds to me liek the mobile has the secritive flag set on it, i remember running about for hours trying to workout why then hell my shops wouldnt work, and it ws because of the secritive flag being set on a couple in the area i was working in.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
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.


222,514 views.

This is page 3, subject is 6 pages long:  [Previous page]  1  2  3 4  5  6  [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.