How could i make an infinit loop so a guy will never stop walking and no dang runtime error will come up
Thanx
ID:179533
Dec 9 2001, 11:36 am
|
|
In response to Lord of Water
|
|
Lord of Water wrote:
That's easy! The goto here worries me quite a bit. I saw it in someone else's code, and the whole thing just seemed so messed up I was afraid to post a response. I'm not one of those nuts who insists that goto is wrong and shall never be used by any competent programmer ever, but there are lots of cases where it's just as easy to avoid it. In this case, a simple while() loop would do the trick: mob/New() There was also the minor problem of Move(NORTH), which wouldn't work as such. Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
I'm not one of those nuts who insists that goto is wrong and shall never be used by any competent programmer ever, but there are lots of cases where it's just as easy to avoid it. It's wrong unless you know enough to know it's not wrong...sort of like handling Kryptonite. If you don't know what you are doing, then don't. In the case cited here, yeah, using goto statements in place of a loop is majorly wrong. |
In response to Deadron
|
|
Deadron wrote:
It's wrong unless you know enough to know it's not wrong...sort of like handling Kryptonite. If you don't know what you are doing, then don't. Agreed! Goto is still a powerful and (I think) oft-overlooked statement, but it acquired a stigma from being used recklessly once better alternatives became available. Well that, and I think top-down programming was such an intellectual novelty in its time that people who embraced it became sort of snobbish towards the idea of using the "old" method of skipping about the program. So I guess the moral of the story is, never use goto--unless you're really sure you can't avoid it without making your code a million times more complicated. Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
Agreed! Goto is still a powerful and (I think) oft-overlooked statement. And it's fun to piss people off with, using the forever looping login screens, hehe. |
In response to Lummox JR
|
|
Lummox JR wrote:
So I guess the moral of the story is, never use goto--unless you're really sure you can't avoid it without making your code a million times more complicated. gosub is okay though. Ah for the days when the main programming problem was predicting how to number your code lines such that you'd have enough line numbers left for any additional code you might add in the future. Until those damn newfangled line renumbers came along and ruined the art of it all. |
In response to Nadrew
|
|
Nadrew wrote:
And it's fun to piss people off with, using the forever looping login screens, hehe. How do you keep an idiot busy for hours? (Read newbie.9675 to find out.) Lummox JR |
In response to Lummox JR
|
|
Lol.
|
In response to Lummox JR
|
|
Lol, i was not even dumb enough to click on it.
|
What you really need is an event loop in your game.
Check out:
byond://Deadron.SimpleLoop