ID:2024751
 
(See the best response by Ter13.)
basically regardless if i tab from the edge or paste it in or whatever it still gives me indentation errors on stuff that should not even have it as a error at all.

turf
grassdec
icon = 'null.dmi'
New()
..() //perform the supercall
if(randfloat2int(randomize,0,100)>95) //1 in 10 chance to have a decoration
overlays += /obj/turf_deco/flower //add the turf decoration
if(randfloat2int(randomize,0,100)>92) //1 in 10 chance to have a decoration
overlays += /obj/turf_deco/bush //add the turf decoration
if(randfloat2int(randomize,0,100)>92) //1 in 10 chance to have a decoration
overlays += /obj/turf_deco/bush2 //add the turf decoration


the 2nd to last line is marked as a indentation error for no reason even though the previous ones are perfectly fine even when i tab it from the very edge into place or even paste it in it still gets indentations errors
This is not a bug. If you hit the edit button on your post, there is very obviously a problem of tabs and spaces being mixed. Your third if() line is not indented the same as the previous two if() lines.
Best response
Also, else-if and switch statements exist.

You probably don't want multiple turf decorations to be showing up on the same turf.

switch pattern:

turf
grassdec
icon = 'null.dmi'
New()
..() //perform the supercall
switch(randfloat2int(randomize,0,100))
if(90 to 100)
overlays += /obj/turf_deco/flower //add the turf decoration
if(80 to 89)
overlays += /obj/turf_deco/bush //add the turf decoration
if(70 to 79)
overlays += /obj/turf_deco/bush2


if-else pattern:

turf
grassdec
icon = 'null.dmi'
New()
..() //perform the supercall
var/rnd = randfloat2int(randomize,0,100)
if(rnd>89)
overlays += /obj/turf_deco/flower //add the turf decoration
else if(rnd>79)
overlays += /obj/turf_deco/bush //add the turf decoration
else if(rnd>69)
overlays += /obj/turf_deco/bush2


I was just talking to Lige the other day about this problem: Apparently every stolen bit of source code that people use around here has taught people that the only logic pattern that exists in DM is the if statement. There's no reason to test the same value three times in a row if you already succeeded. It often results in undesirable behavior.
In response to Ter13
Ter13 wrote:
I was just talking to Lige the other day about this problem: Apparently every stolen bit of source code that people use around here has taught people that the only logic pattern that exists in DM is the if statement. There's no reason to test the same value three times in a row if you already succeeded. It often results in undesirable behavior.

Excellent point; I missed that because I was only focused on the indentation.

If you look at your logic, Mastergamerxxx, you're getting a new random value in each if(), and there's no else statement. That's desirable if you want all three decoration types to be able to appear on the same turf, but not so much if you only one one possible decoration.
yeah i encountered that issue recently and was gunna ask about that but ya beat me to it