Nadrew wrote:
Ah, totally missed that. My bad. Toby, you should NEVER have to use the : operator like that, that's what typecasting is for; a lot less prone to runtime error out and crash the proc.

Well, I set up an embedded if to make sure the variable wasn't null :(...
Even if the variable isn't null there's a chance it could be something that doesn't have the variable you're trying to access. Which will result in a runtime error. You should have an istype() check and then make a new variable of the type you're checking and set usr.lastatt to that variable and use said variable to access it.

You know, typecasting.
Nadrew wrote:
Even if the variable isn't null there's a chance it could be something that doesn't have the variable you're trying to access. Which will result in a runtime error. You should have an istype() check and then make a new variable of the type you're checking and set usr.lastatt to that variable and use said variable to access it.

You know, typecasting.

Well, the lastatt can only be set to either an mob, or null. It is set only through a proc called DeathCheck... Which is strictly for mob's... I understand your saying I could be more causious. And honestly I have done(atleast if I understand correct) what your saying to do in other proc's... However, isn't it kinda un-needed here?
Why misuse of usr is bad: Lummox wrote an article called usr Unfriendly that goes into depth on the kind of problems that using 'usr' where it doesn't belong can create. This is a good topic to look into because misuse of 'usr' can create a LOT of problems later on, even if things appear to work right at first.

Why misusing : is bad: Normally you want to check 'obj.var'. In some very rare situations, of which I've never actually encountered one, you can't do that, so you need to do 'obj:var'. But chances of that happening to you are astronomically slim.

The problem is that using : in your code won't create compiler errors where they should be created. So you can have code that's totally screwed up, and you won't find out about it while you're compiling the game, instead you'll find out about it when a player does some obscure thing that you never thought to test and encounters an error because you used :.

Plus, using : is inherently slower than using ., so it just needlessly slows down your game.

Why boolean checks are good: Kakashi made a blog post that explains some of this, you can read it here.
Ss4toby wrote:
Im a self taught coder...

I'm self-taught too. I've been around since '05, and I still know how to avoid those pitfalls.

If it works I use it. If it doesn't I fix it... That simple.

Based on this logic, you're content with using a screwdriver to pound in nails, because "it works".
Popisfizzy wrote:
Ss4toby wrote:
Im a self taught coder...

I'm self-taught too. I've been around since '05, and I still know how to avoid those pitfalls.

If it works I use it. If it doesn't I fix it... That simple.

Based on this logic, you're content with using a screwdriver to pound in nails, because "it works".

Lol!!! Sadly when I was 5 to 7(cant remember) I really did use a screwdriver to hammer some nails into wood ^_^....
Foomer wrote:
Why misuse of usr is bad: Lummox wrote an article called usr Unfriendly that goes into depth on the kind of problems that using 'usr' where it doesn't belong can create. This is a good topic to look into because misuse of 'usr' can create a LOT of problems later on, even if things appear to work right at first.

Why misusing : is bad: Normally you want to check 'obj.var'. In some very rare situations, of which I've never actually encountered one, you can't do that, so you need to do 'obj:var'. But chances of that happening to you are astronomically slim.

The problem is that using : in your code won't create compiler errors where they should be created. So you can have code that's totally screwed up, and you won't find out about it while you're compiling the game, instead you'll find out about it when a player does some obscure thing that you never thought to test and encounters an error because you used :.

Plus, using : is inherently slower than using ., so it just needlessly slows down your game.

Why boolean checks are good: Kakashi made a blog post that explains some of this, you can read it here.


I understandish what your saying to me... Instead of creating a code that could possible be a problem, make one that I know wont be?.... I dont know though... Kinda goes against what I've been doing for all these years >.<... That's right!! True stupidity..
Ss4toby wrote:
I understandish what your saying to me... Instead of creating a code that could possible be a problem, make one that I know wont be?.... I dont know though... Kinda goes against what I've been doing for all these years >.<... That's right!! True stupidity..

Its all up to you in the end. But if you want to make programming more difficult on yourself, making code that breaks easily and is hard to read is definitely the way to do it.

Just don't go trying to releases demos or libraries that way.

Foomer wrote:
Ss4toby wrote:
I understandish what your saying to me... Instead of creating a code that could possible be a problem, make one that I know wont be?.... I dont know though... Kinda goes against what I've been doing for all these years >.<... That's right!! True stupidity..

Its all up to you in the end. But if you want to make programming more difficult on yourself, making code that breaks easily and is hard to read is definitely the way to do it.

Just don't go trying to releases demos or libraries that way.

Well, it's easy for me to read Honestly... I just sometimes lose train of thought... I dont have a disorder or anything, just do... Also, look to the left... It's kinda too late when it comes to demos/libraries :D!!! Which don't go looking at them... Too many people have complained about them.. :(!
Has this suddenly become a battlefield? TAAAAAKE COVVEEEEERRR!!! -jumps into some trenches to avoid getting killed by "flame" bombs-

HOLY SHIT!! THEY'RE FLAMING EACHOTHER!! GOTTA GET MY m-16!! ROAR!!!
Duelmaster409 wrote:
Has this suddenly become a battlefield? TAAAAAKE COVVEEEEERRR!!! -jumps into some trenches to avoid getting killed by "flame" bombs-

HOLY SHIT!! THEY'RE FLAMING EACHOTHER!! GOTTA GET MY m-16!! ROAR!!!

No one has been flamed... I have yet to insult anyone becide poppyseed(whatever his name is) and you... You have a big o'l flappy wang.... Freak...
* At which point Foomer unsubscribes from this thread. *
Page: 1 2