Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 11th Jul 2010 19:45
This is my code, and I do not know why it is not working. It is a start to my RPG.

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 12th Jul 2010 00:13 Edited at: 12th Jul 2010 00:17
The code above doesn't compile because of incorrect use of the if command.

You can use if in 2 ways.

method number 1

if a=1 then print "hello"

method number 2

if a=1
print "hello"
endif

What you have done is started method 2, but missed off the endif (hence being unable to close loop)


Other things to note, firstly, labels end in a colon ( : ) not a semicolon ( ; ) and there are better ways of structuring code like this without using dozens of goto commands.

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 12th Jul 2010 02:44
It also helps if you indent your code and use block statements. This makes it easier for yourself and anyone else to read and also makes debugging your code easier.

A clever person solves a problem, a wise person avoids it - Albert Einstein
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Jul 2010 04:48
The best help I can give you is to advise you to try an easier project than a RPG.

It is important that you learn how to structure your code in such a way that it is easier to read and debug. Using the outdated GOTO command is going to bring you headaches and difficulty in finding programming bugs. As =Prof= advised, learn to write code using subroutines or functions.

If you simply have your heart set on making an RPG, and won't hear of doing a pong game, breakout game, etc. there is a tutorial that might help you, The link:

http://forum.thegamecreators.com/?m=forum_view&t=64198&b=7


mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 12th Jul 2010 21:24 Edited at: 13th Jul 2010 18:04
I see where it messed up, in the Potion system, I didn't string it. Thank you for your help.

EDIT: Now, it says THIS code doesn't work. Please Help.

Aikidoka
15
Years of Service
User Offline
Joined: 14th May 2009
Location: Australia
Posted: 15th Jul 2010 11:47
Hey there Mappel,

At a brief glimpse I can see a few things wrong with this code.
I'll need to look at it closely when I'm at home.

Structure definitely needs work, I use to code like this...a LOOONG time ago. It needs comments/documentation so it's easy to follow.

It is an ambitious project, but don't give up.
mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 15th Jul 2010 16:24
Aikidoka, the project is working fine. If there were no errors, though, I could be working past the tutorials. NOTE: I am posting this as WIP when errors are fixed.
Aikidoka
15
Years of Service
User Offline
Joined: 14th May 2009
Location: Australia
Posted: 17th Jul 2010 05:54
Ok,
I've gone over the code and fixed the errors.
They weren't anything too dramatic, just missing a " here, an ENDIF there. Some variables weren't consistant. I've added comments where I've made changes.

There is no routine if your character doesn't have "Basic Sword". I didn't add that. I'll leave that up to you.

I didn't check to see what happens if you don't type what's expected. Also, it would be nice to see dialogue depicting what the goblin is doing.

I'll stop rambling...just analyze my code adustments

Attachments

Login to view attachments
mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 18th Jul 2010 23:34
I looked through this coding, I didn't see anything wrong, yet it wouldn't run the program. Please help.
Aikidoka
15
Years of Service
User Offline
Joined: 14th May 2009
Location: Australia
Posted: 19th Jul 2010 08:02 Edited at: 19th Jul 2010 23:21
There is an if argument open

Login to post a reply

Server time is: 2024-11-16 14:05:14
Your offset time is: 2024-11-16 14:05:14