ID:138996
 
Code:
        Use_Tps()
set category = "Channels"
switch(input("Where do you wish to use your TPs?","TPs")in list("Powerlevel","Ki","Ki Defense","Strength","Defense","Stamina","Exp","Cancel"))
if("Exp")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/pl=20*TP
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.powerlevel_max+=pl
usr.powerlevel+=pl
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(pl),15)] Exp!"
usr.tp-=TP
return
if("Stamina")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/pl=TP/1.5
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.staminaleft_max+=pl
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(pl),15)] Stamina!"
usr.tp-=TP
return
if("Powerlevel")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/pl=rand(400,500)*TP
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.powerlevel_max+=pl
usr.powerlevel+=pl
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(pl),15)] Powerlevel!"
usr.tp-=TP
return
if("Ki")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/pl=rand(400,500)*TP
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.ki_max+=pl
usr.ki+=pl
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(pl),15)] Ki!"
usr.tp-=TP
return
if("Ki Defense")
var/TP = input ("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/pl = rand(400,500) * TP
if(TP > usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP == 0 || TP == null || !TP)
return
while(TP == 0 || TP == null || !TP)
return
if(TP < 0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.kidefense_max += pl
usr.kidefense += pl
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(pl),15)] Ki Defense!"
usr.tp -= TP
return
if("Strength")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/str=rand(80,100)*TP
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.strength+=str
usr.strength_max+=str
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(str),15)] Strength!"
usr.tp-=TP
return
if("Defense")
var/TP=input("How many TPs do you wish to use? [num2text(round(usr.tp),15)] TPs") as num
var/str=rand(80,100)*TP
if(TP>usr.tp)
usr<<"<font color=white>TP Specialest:</font> You don't have that many TPs!"
return
if(TP==0||TP==null||!TP)//this line has the error
return
while(TP==0||TP==null||!TP)
return
if(TP<0)
usr<<"<font color=white>TP Specialest:</font> You must enter a positive number!"
return
usr.defence+=str
usr.defence_max+=str
usr<<"<font color=white>TP Specialest:</font> You have gained [num2text(round(str),15)] Defense!"
usr.tp-=TP
return
if("Cancel")return


Problem description:
SagasReborn Codings\Options.dm:319:error: if: expected end of statement
(12 lines above the last line is where the error is
Your if() is wrongly intended 3 lines above your error.

Also, golden rule in programming, whenever you're repeating large chunks of code, you're doing it wrong.
In response to Emasym
o wow i didnt even notice that thanks alot dude.
I want to explain to you about Boolean operators.

Boolean has two possible values: TRUE and FALSE.
In BYOND, FALSE is either 0, null or an empty string ""
TRUE is anything but a FALSE value (ex: referenced object, number, string, etc.)

if(val)
If the value is true, do this (meaning it is anything but 0, "", null)

if(!val)
If the value is false, do this

if(val == 2)
if value is exactly 2, do this ((val==2) will return 1 (TRUE)).

So where you had if(TP==0||TP==null||!TP), all you need is if(!TP)

In addition, the while() statement you used is useless. Once return is called, the procedure stops which means that the while() is not called. What were you attempting to do? while() is like saying:
while(condition)
Do this

Is the same thing as:

LOOP
if(condition)
Do this
goto LOOP

Ultimately useless in the way you had it.