![]() |
need some help with this damn code...rage...
hay xpi0t0s, or anyone else who decides to tell me stuff. i took a bit of a break from this code and i cam back, i reformatted so i lost all the stuff i had done but no matter. i still remember it all. (i am vary good at remembering numbers) but i still ahve the same problem as before, the stupid encounter thing xpi0t0s was trying to tell me about. here is my code so far, i think it if good enough for a demo of what you were trying to tell me. please if it would not be too much trouble could you xpi0t0s, or anyone else who cares edit in the proper way to make it when you go south || 's' of the starting location message pops up saying "monster" or something... using the monster array at the top.
Code:
#include <iostream> |
Re: need some help with this damn code...rage...
Sorry, it is a bit of a cryptic username. I got sick of other people nicking the good names I thought of, saxman, jazzman, even jazman with one z got nicked, so I thought why don't I start using an old password instead. So far I've never seen anyone else use xpi0t0s, probably because nobody can figure out what the heck it means.
If you're going to use the fairly simple construct of "if (placement==1) { } if (placement==2) { } ..." then you don't need the monster array at all; just bung all the code in the "if placement==2" clause. The point of the arrays is that it gets you out of writing all the duplicate code you would have to write if you stick to the simple construct, and gives you additional flexibility in that monsters can move from location to location as they might in "real" life. So just do something like: Code:
if (placement==2)Oh, and keep backups!!! I use Peters Backup; it's simple and runs daily in Scheduled Tasks. Backup selectively though, otherwise you'll end up using tons of DVDR's. |
Re: need some help with this damn code...rage...
does your name mean christ, in greek? i think.
and thank man, i think i have found a different way of doing this, please tell me if there is a horrible flaw or doing this is just stupid. Code:
#include <iostream> |
Re: need some help with this damn code...rage...
Yes, that's right. Christ in Greek, take the English letters that most closely resemble the Greek letters then replace a couple of letters with digits (because the Unix system at the time insisted on at least one digit in passwords). (I'm a follower of Jesus Christ)
Well, you're still using the "if placement==n" approach and lots of duplicate code; the trap and monster stuff is repeated within each "if" block. There's nothing wrong with this if the program is going to stay small and is just for experimenting, maybe if you stay under 20 nodes or so you'll have no problem. But if you're planning to develop this into a large game with hundreds of nodes then this is going to lead to a massive program that is impossible to keep track of and debug - there'll be lots of duplicate code, and if you want to change the behaviour (maybe process monsters before traps) then you'll have to do that for each if block. Hence my previous suggestion of describing the game in data rather than in software, and making the software generic. |
| All times are GMT +5.5. The time now is 12:51. |