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.

Newcomers DBPro Corner / Battle System Help.

Author
Message
mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 14th Oct 2010 03:54
I am in the process of making a game(Duh). I need help with the battle, at the bottom. Here is my entire code.

If someone can help, please help.
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 14th Oct 2010 04:30 Edited at: 14th Oct 2010 04:30
I honestly can't help because I have no idea where your gotos are leading and I can't see because of no indentation. But heres some battle system code I made a long time ago. See if you can learn anything or if it can help.



Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Oct 2010 08:23 Edited at: 14th Oct 2010 10:53
Quote: "I am in the process of making a game(Duh)."


Holy cow! 27 GOTO statements! That's a code nightmare. I'm going to de-GOTO your code. It may take me a while though.

Edit: Ok it took a bit but here is your code free of GOTO and GOSUB statements. It could of course be made more efficient but I first just wanted to remove the evil GOTOs.



For the battle code at the end (the part you really wanted help with) I set it up using Turn to indicate which persons turn it is to attack (0=Player 1=Alice 2=Enemy). If you have any questions just post again in this thread (I would go into more details on the code but it's time for bed).

mappel6
14
Years of Service
User Offline
Joined: 7th Jul 2010
Location:
Posted: 15th Oct 2010 03:08
Grog Grueslayer:

I tried the modified code. It apparently has a problem at "inc fullhealpotion." Thank you for the modified code, but I need that part fixed and it might work. I do not know if it will help, but I am using BlueIDE.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Oct 2010 20:17 Edited at: 15th Oct 2010 20:21
No problem... as you can see by my signature I'm not fond of GOTO.

I use BlueIDE too (till I get used to Indigo) and it works fine (see attached image). I did notice you should probably remove line 133 where Alice tells the user to type look to look for monsters. The next INPUT line is the same so line 133 is not needed.

Generally with errors the line it says it's on is not the line the actual error is at but rather above that line somewhere. What's the error?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-09-28 22:26:44
Your offset time is: 2024-09-28 22:26:44