ID:265135
 
I'm trying to make a screen obj when you click it it gives you the option of what monsters you want to attack with...

there's 11 monsters for each race, plus I think 10 or 11 special monsters. There's 3 races, that makes 33 plus 10 which is 43 monsters. The monsters aren't actually monsters, they're just vars That show up on the screen. The thing is, each one has it's own weakness's to diff monsters, etc.

Now is there any way of getting around having to type about a couple hundred lines of code?? Any ideas???
Probably something like 3 lists, a list for the monsters, a list for each monster's weakness, and a list for each monster's strengths. Then, you can select a monster, and get it's reference from each list to get it's stats, and so on.
In response to Garthor
Ahh, the beauty of lists.
Jon Snow wrote:
I'm trying to make a screen obj when you click it it gives you the option of what monsters you want to attack with...

there's 11 monsters for each race, plus I think 10 or 11 special monsters. There's 3 races, that makes 33 plus 10 which is 43 monsters. The monsters aren't actually monsters, they're just vars That show up on the screen. The thing is, each one has it's own weakness's to diff monsters, etc.

Now is there any way of getting around having to type about a couple hundred lines of code?? Any ideas???

Not really, no. Your code wouldn't have to have any redundancy in it, either, to get up to that length. I doubt this would be a super-complicated thing to program, but a couple hundred lines for the whole works sounds accurate.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Not really, no. Your code wouldn't have to have any redundancy in it, either, to get up to that length. I doubt this would be a super-complicated thing to program, but a couple hundred lines for the whole works sounds accurate.

And that only seems like a lot because you are learning. After you've programmed for a while, you'll find times where you plop down this many lines without thinking about it.
In response to Deadron
Deadron wrote:
And that only seems like a lot because you are learning. After you've programmed for a while, you'll find times where you plop down this many lines without thinking about it.

Indeed. I often find relatively simple sections of code ending up at a few hundred lines. Most things I do to a higher level of complexity end up with considerably more than that.

Besides, in BYOND line numbers can be deceptive anyway, because the syntax tends to discourage (slightly) a more compact format. I often find myself doing something on 3 or 4 lines that I'd only take one line to do in C or Java.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Deadron wrote:
And that only seems like a lot because you are learning. After you've programmed for a while, you'll find times where you plop down this many lines without thinking about it.

Indeed. I often find relatively simple sections of code ending up at a few hundred lines. Most things I do to a higher level of complexity end up with considerably more than that.

Yep. Battle for Solaris has around 150 lines of code per feature, minimum. Most of this is simply because the number of situations is hard-coded (for example, the lasers have little need to be object-oriented, due to the fact that the game only has two different weapon types. The lasers are object-oriented for the most part, but there are several places in which their procedures are hard-coded.).


Besides, in BYOND line numbers can be deceptive anyway, because the syntax tends to discourage (slightly) a more compact format. I often find myself doing something on 3 or 4 lines that I'd only take one line to do in C or Java.

Yep... whitespace is your best friend. Your next best friend is adding backslashes before newlines to keep text strings visible on the width of a single screen.

(Eg.

Assuming there was no automatic word-wrap (it's uncouth to turn off the word wrap here, since it makes the post less readable if someone has their reading method set to All) :
usr << "This is a really long sentence, and, as you might be able to tell, it will probably scroll off the edge of Dream Maker's right-hand side, creating a scrollbar on the bottom of the Dream Maker window and otherwise causing a portion of the string to be cut-off whenever a designer browses through the code."

versus:
usr << "This is a really long sentence, and, as you might \
be able to tell, it will probably not scroll off \
the edge of Dream Maker's right-hand side, and it \
won't create a scrollbar on the bottom of the Dream \
Maker window or otherwise cause a portion of the \
string to be cut-off whenever a designer browses \
through the code."
)
In response to Spuzzum
Or {} (braces). I don't know if they autoline or not though.
In response to Deadron
Hehe in some of my code files I tend to put so much coding, it's a 4 hour job to edit just small bits of each proc. In one code file I have 7170 strings of coding, and in another I have 3036 stings, and lots more files just like that hehe ;P.