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.
 Entire forum ➜ Programming ➜ General ➜ Coding Question

Coding Question

Posting of new messages is disabled at present.

Refresh page


Pages: 1 2  

Posted by DemiGod   (22 posts)  Bio
Date Wed 18 Mar 2009 01:14 AM (UTC)
Message
I have a bit of a general question...

I have a general beginner's grasp on coding C. I understand how to use grep.

Now, how do i know exactly where I need to start putting new data, or how many files are affected by certain skills/spells/etc.

For example, if I want to create an entirely new system, say a botany system that involves preparing and applying specific commands to grow new plants, where would i even turn to begin coding these things? Let's assume here that i know how to code what I want to happen.

Also, if I decide to change a skill, for example the preset "bash", I can grep the skill in one folder but not in ALL folders. Can someone indicate which folders I have to check in order to make sure that I have covered my tracks with any changes I decide to make?

Thanks,
Demi
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 18 Mar 2009 02:10 AM (UTC)
Message
I might let the Smaug experts answer about where you would start putting new stuff (my opinion would be wherever you want, that makes sense to you).

However you need to "hook" new things into the existing code in ways that implement what you need. For example, if something needs to happen periodically, then some test in the "heartbeat" part would be required.

As for grepping, I would look in the src directory for source code changes, and the system directory for skills.dat and commands.dat.

- Nick Gammon

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

Posted by DemiGod   (22 posts)  Bio
Date Reply #2 on Wed 18 Mar 2009 02:44 AM (UTC)
Message
Maybe I can add this side question here as well..

i can't find and sources on using andlinux, but cygwin just wasn't working for me. I was having the same errors come up as the other post by dbaker that had to do with none of the commands working in game.

I decided to install andlinux. Does anyone have experience with smaug and andlinux? For the life of me, I can't find any good information on how to go about compiling this code. I just get errors upon errors.

- Demi
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Wed 18 Mar 2009 01:20 PM (UTC)
Message
It's fairly likely that the compilation errors are coming from the code itself, not from the environment (AndLinux vs. Cygwin vs. ...)

If you're using a SMAUG base, or an older FUSS base, it's likely that you're getting the (in)famous constness errors. My suggestion would be to upgrade to the latest version of SmaugFUSS -- it's technically better than vanilla SMAUG anyhow.

As for your question, Nick is right, you can probably put it wherever it makes sense to you, but you'll have to hook into the standard mechanisms. For instance you'll need to add your new do_function to the skill table, and create your skill using the OLC commands.

If you're messing with skills, it's usually better to not play many games with renaming existing skills since they could be referenced in area files, for example. It's easiest to create new ones, and then just disable the old ones from the OLC commands.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by DemiGod   (22 posts)  Bio
Date Reply #4 on Wed 18 Mar 2009 02:37 PM (UTC)

Amended on Wed 18 Mar 2009 02:57 PM (UTC) by DemiGod

Message
is the 1.9 download from Nick's download area not the most current? I'll post a log of the errors in a bit.

[root@andLinux src]# make
make -s smaug
Compiling o/imc.o....
make[1]: g++: Command not found
make[1]: *** [o/imc.o] Error 127
make: *** [all] Error 2
[root@andLinux src]#

am I missing some parts of andlinux that I need or do i have to go about this differently?

When i used the gcc compiler [i.e. gcc -Wall act_move.c... etc] i got many other kinds of errors. Which way is the correct way to use andlinux?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #5 on Wed 18 Mar 2009 02:51 PM (UTC)
Message
Yes, that is the most current, I just wasn't sure if it was what you were using. (usually the first thing to say in a question like this is what codebase/version you're using, where you got it, etc.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by DemiGod   (22 posts)  Bio
Date Reply #6 on Wed 18 Mar 2009 02:57 PM (UTC)

Amended on Wed 18 Mar 2009 06:27 PM (UTC) by DemiGod

Message
It is the 1.9 version from this site, without any changes made.

Ok thanks for the help guys. I needed to install the g++ package. I'll let you know if I have more trouble.

One note, with g++ the source compiled into .o files from the .c. Is there another step to producing the executable?
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #7 on Wed 18 Mar 2009 06:23 PM (UTC)

Amended on Wed 18 Mar 2009 06:24 PM (UTC) by Nick Cash

Message
If you ran the Makefile it should have produced an executable for you. Try running the default startup script and see what happens. The default binary should be named 'smaug' if I recall correctly.

~Nick Cash
http://www.nick-cash.com
Top

Posted by DemiGod   (22 posts)  Bio
Date Reply #8 on Wed 18 Mar 2009 06:28 PM (UTC)
Message
Alright I tried running 'smaug' which seemed to load the server but I can not connect to it.

When i ran this in cygwin i could connect without a problem, but now with andlinux I can't seem to connect. The connection is refused.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #9 on Wed 18 Mar 2009 07:17 PM (UTC)
Message
Did you verify it was running with ps?

You're connecting via telnet localhost?

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

Posted by DemiGod   (22 posts)  Bio
Date Reply #10 on Wed 18 Mar 2009 07:22 PM (UTC)

Amended on Thu 19 Mar 2009 12:31 AM (UTC) by DemiGod

Message
ps?

I am using mushclient, but telnet doesn't work either.

here's the end of the command:

Tue Mar 18 15:11:55 2008 :: Initializing socket
Tue Mar 18 15:11:55 2008 :: IMC: Loading IMC2 command table...
Tue Mar 18 15:11:55 2008 :: IMC: Loading IMC2 network data...
Tue Mar 18 15:11:55 2008 :: IMC: Loading IMC2 help file...
Tue Mar 18 15:11:55 2008 :: IMC: Loading IMC2 color table...
Tue Mar 18 15:11:55 2008 :: IMC: Loading IMC2 who template...
Tue Mar 18 15:11:55 2008 :: IMC: imcfread_word: EOF encountered on read.
Tue Mar 18 15:11:55 2008 :: IMC: IMC2 network data loaded. Autoconnect not set. IMC2 will need to be connected manually.
Tue Mar 18 15:11:55 2008 :: (Name Not Set) ready on port 4000.


also, is this 'smaug' file that I am running something that came with the code i downloaded or did I actually compile this? I ask because once i change some code, i want to know if i will be back to square one with all these compiling issues.

I found one decent article about compiling but it doesn't really help me too much and I can't find anything else.

http://www.network-theory.co.uk/docs/gccintro/gccintro_14.html
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #11 on Wed 18 Mar 2009 10:08 PM (UTC)

Amended on Wed 18 Mar 2009 10:09 PM (UTC) by Nick Gammon

Message
For help on compiling, see my own notes on that:

http://www.mushclient.com/compiling

The command "ps" shows which processes are running, you type that from a command prompt. To narrow it down, you could type:


ps -waux  | grep smaug


That would show processes with smaug in the name.

Quote:

is this 'smaug' file that I am running something that came with the code i downloaded or did I actually compile this


From the command prompt, type "ls -l". Does the date/time on the smaug file agree with when you compiled it, or is it years old? (that is -L in lower case, not the number "one").

- Nick Gammon

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

Posted by DemiGod   (22 posts)  Bio
Date Reply #12 on Thu 19 Mar 2009 12:35 AM (UTC)

Amended on Thu 19 Mar 2009 02:28 AM (UTC) by DemiGod

Message
[root@andLinux ~]# ps -waux | grep smaug
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 3869 5.0 2.1 8900 5440 pts/0 S+ 20:31 0:01 ../src/smaug
root 3878 0.0 0.2 1668 516 pts/1 R+ 20:32 0:00 grep smaug

I have in fact read your compiling overview when I started out using cygwin, but i was receiving errors exactly matching those of the following thread:

http://www.gammon.com.au/forum/bbshowpost.php?id=8841

So I moved researched and found no answers. I moved on and decided to use andLinux. After installing and messing with it, the 'make' command didn't even work without downloading g++ which I don't see why I need since this is C and not C++.

Anyhow, I installed that g++ add-on and started playing with make. I don't know if I'm just missing libraries or requisite add-ons that I need to compile correctly but somehow I can't get a good compile.

When I use the gcc commands I get a huge list of errors. Using make, I can make the .o files from the corresponding .c files but no executable comes with it [edit: the smaug executable is in fact created when i 'make smaug'].

And yes, the files, after inputing 'ls -l" are years old - at least most are. Some are of today's date, including smaug. However, the .o files I created are of the correct date [today].

[edit] Do i have to make any changes to the makefile depending on what programs I use? I noticed some things are commented when it says 'uncomment if using cygwin' for example, which I never bothered to look at.
Top

Posted by DemiGod   (22 posts)  Bio
Date Reply #13 on Thu 19 Mar 2009 02:29 AM (UTC)

Amended on Thu 19 Mar 2009 04:25 AM (UTC) by DemiGod

Message
Ok i think I am actually compiling this thing alright now..

I have the executable but I simply can not connect:

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 3310 1.4 2.1 8904 5460 pts/0 S+ 22:25 0:04 ../src/smaug 4000
root 3324 0.0 0.2 1672 520 pts/1 R+ 22:29 0:00 grep smaug

I am using localhost instead of 127.0.0.1 on port 4000.

No connection. Any ideas guys? I don't see why getting this to work 'out of the box' is becoming such a task.

[edit: does it matter that I am behind a router? Does andLinux see itself under some other network?]
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #14 on Thu 19 Mar 2009 04:06 AM (UTC)
Message
I can't comment about andlinux, you seem to be doing the right thing. It certainly works under Cygwin.

I would use Cygwin myself, and resolve the errors. Switching to andlinux seems to me to have replaced one problem with another one.

Possibly the Windows firewall is blocking incoming connections to andlinux.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


58,320 views.

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

Posting of new messages is disabled at present.

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.