ID:145319
 
Ive been adding some code to a friends game, but i keep getting these errors that say "Inconsistent indentation"

Code:
mob/proc/scouter_sales()

var/obj/Equipment/Scouters/O=new

switch(input("Want colour of Scouter do you want to buy? 750Z per scouter")in list("Green","Red","Blue","Yellow","Pink","Never Mind"))

if("Never Mind")
return


if("Green")
if(usr.zenni >= 750)
usr.zenni -= 750
O.icon = 'Green Scouter.dmi'
O.UNDER = 'Green Scouter.dmi'
usr.contents += new/obj/Equipment/Scouter
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> Thanks for buying!"
return
else
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> You cannot afford this!"
return


if("Red")
if(usr.zenni >= 750)
usr.zenni -= 750
O.icon = 'Red Scouter.dmi'
O.UNDER = 'Red Scouter.dmi'
usr.contents += new/obj/Equipment/Scouter
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> Thanks for buying!"
return
else
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> You cannot afford this!"
return


if("Blue")
if(usr.zenni >= 750)
usr.zenni -= 750
O.icon = 'Blue Scouter.dmi'
O.UNDER = 'Blue Scouter.dmi'
usr.contents += new/obj/Equipment/Scouter
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> Thanks for buying!"
return
else
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> You cannot afford this!"
return

if("Yellow")
if(usr.zenni >= 750)
usr.zenni -= 750
O.icon = 'Yellow Scouter.dmi'
O.UNDER = 'Yellow Scouter.dmi'
usr.contents += new/obj/Equipment/Scouter
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> Thanks for buying!"
return
else
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> You cannot afford this!"
return

if("Pink")
if(usr.zenni >= 750)
usr.zenni -= 750
O.icon = 'Pink Scouter.dmi'
O.UNDER = 'Pink Scouter.dmi'
usr.contents += new/obj/Equipment/Scouter
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> Thanks for buying!"
return
else
usr << "<font size = -1><B><font color = blue>Shop Keep:</font> You cannot afford this!"
return


Problem description:

It hightlights switch(input("Want colour of Scouter do you want to buy? 750Z per scouter")in list("Green","Red","Blue","Yellow","Pink","Never Mind")),
Return, if(usr.zenni >= 750), else, if("Red")
Read the Error Codes Bwicki Page.

Hiead
In response to Hiead
Problem: Failing to correctly indent a line where it is an obvious error.
I know that..But i still need help, i dont know how to fix what is wrong

Fix: Go over the block of code that the error leads to. Try scanning upward from there. On every line, delete all of the tabs and spaces and re-indent it to its proper level -- make sure you understand what proper indentation is, though! The above example should look like:
In response to Wot
It seems to me that the line before it is indented with spaces as opposed to tabs.

Hiead
In response to Wot
The problem is that you've indented incorrectly.

Hitting Ctrl-t will show you where you have tabs and things. Check to see you don't have spaces where there should be tabs.
In response to Hiead
I only have 2 errors now, I need help on both
which are: NPC(s)\Shopkeeper\Scouter sales.dm:3:error:O :unknown variable type AND
NPC(s)\Shopkeeper\Scouter sales.dm:5:error::invalid expression
Code:
mob/proc/scouter_sales()

var/obj/Equipment/Scouters/O=new

switch(input("Want colour of Scouter do you want to buy? 750Z per scouter")in list("Green","Red","Blue","Yellow","Pink","Never Mind"))

if("Never Mind")
return


Problem description:this is the first one var/obj/Equipment/Scouters/O=new
and this is the second one switch(input("Want colour of Scouter do you want to buy? 750Z per scouter")in list("Green","Red","Blue","Yellow","Pink","Never Mind")

In response to Wot
Wot wrote:
mob/proc/scouter_sales()
>
> var/obj/Equipment/Scouters/O=new
>
> switch(input("Want colour of Scouter do you want to buy? 750Z per scouter")in list("Green","Red","Blue","Yellow","Pink","Never Mind"))
>
> if("Never Mind")
> return
>


Un-indent the line starting with switch(... by one tab.

Hiead
In response to Hiead
Ive still got that one error NPC(s)\Shopkeeper\Scouter sales.dm:3:error:O :unknown variable type


Code:
mob/proc/scouter_sales()

var/obj/Equipment/Scouters/O=new


Problem description:Which highlights var/obj/Equipment/Scouters/O=new
In response to Wot
Wot wrote:
Ive still got that one error NPC(s)\Shopkeeper\Scouter sales.dm:3:error:O :unknown variable type


Code:
> mob/proc/scouter_sales()
>
> var/obj/Equipment/Scouters/O=new
>

Problem description:Which highlights var/obj/Equipment/Scouters/O=new

The /obj/Equipment/Scouters path is probably not represented in your code, meaning that O has an invalid type as it points to an invalid type path.

Hiead
In response to Hiead
I dont understand how to fis this though
In response to Wot
Wot wrote:
I dont understand how to fis this though

obj/Equipment/Scouters


Try adding that in, with no indents to the left of it, and not in the middle of a proc.

Hiead
In response to Hiead
ive got that fixed but have more problems, anyways im going to sleep, Thna alot Hiead for your help
In response to Wot
Didn't anyone notice the huge usr abuse? :/