ID:1888266
 
(See the best response by IchiroKeisuke.)
Code:
mob
proc
Statup(obj/O as num)
set background=1
if(src.Tessenka){return 0}
if(src.ByakuganUse){return 0}
if(src.SharinganUse){return 0}
if(src.usedhero){return 0}
if(src.MangekyouUse){return 0}
if(src.Cseal){return 0}
if(src.DemonUse){return 0}
if(src.shimon){return 0}
if(src.kyomon){return 0}
if(src.tomon){return 0}
if(src.sheimon){return 0}
if(src.keimon){return 0}
if(src.shomon){return 0}
if(src.kumon){return 0}
if(src.kaimon){return 0}
if(src.seimon){return 0}
src.Save()
start
if(src.points<=0)
src.points=0
return
if(src.Clan=="Puppet Master"||src.Clan=="Human Puppet")
switch(input(src,"Distribute Points.","[src.points] Points left",text) in list ("Taijutsu","Genjutsu","Ninjutsu","Speed","Puppetry","Save for later"))
if("Taijutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Tai+=D
src.mTai+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Ninjutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Nin+=D
src.mNin+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Genjutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Gen+=D
src.mGen+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Speed")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.speed+=D
src.maxspeed+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Puppetry")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Puppetry+=D
src.mPuppetry+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Save for later")
return 0
goto start

if(src.Clan=="Lee")
switch(input(src,"Distribute Points.","[src.points] Points left",text) in list ("Taijutsu","Speed","Save for later"))
if("Taijutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Tai+=D
src.mTai+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Speed")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.speed+=D
src.maxspeed+=D
src.points-=D
else
alert(src,"You don't have enough points!")
if("Save for later")
return 0
goto start
else
if(src.Clan!="Lee"||!src.Clan=="Puppet Master"||!src.Clan=="Human Puppet")
switch(input(src,"Distribute Points.","[src.points] Points left",text) in list ("Taijutsu","Genjutsu","Ninjutsu","Speed","Save for later"))
if("Taijutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Tai+=D
src.mTai+=D
src.points-=D
else
alert(src,"You don't have enough points!")

/*
if("Stamina")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.maxstamina+=D
src.points-=D
else
alert(src,"You don't have enough points!")
*/


if("Ninjutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Nin+=D
src.mNin+=D
src.points-=D
else
alert(src,"You don't have enough points!")

if("Genjutsu")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.Gen+=D
src.mGen+=D
src.points-=D
else
alert(src,"You don't have enough points!")

if("Speed")
var/D=input("How many points?","Points") as num
if(D<=0){return 0}
if(D<=src.points)
src.speed+=D
src.maxspeed+=D
src.points-=D
else
alert(src,"You don't have enough points!")

if("Save for later")
return 0

goto start


Problem description:

okay the thing is when i pick the puppet master clan the "Puppetery Skill" stat wont popuo when i try to invest points?
Best response
If you want help you need to post a better description of your problem.

And also..

Break these large tasks up into smaller ones that are more manageable, so your code will be a lot cleaner and more maintainable.

for starters, you should probably put things like this:
            if(src.Tessenka){return 0}
if(src.ByakuganUse){return 0}
if(src.SharinganUse){return 0}
if(src.usedhero){return 0}
if(src.MangekyouUse){return 0}
if(src.Cseal){return 0}
if(src.DemonUse){return 0}
if(src.shimon){return 0}
if(src.kyomon){return 0}
if(src.tomon){return 0}
if(src.sheimon){return 0}
if(src.keimon){return 0}
if(src.shomon){return 0}
if(src.kumon){return 0}
if(src.kaimon){return 0}
if(src.seimon){return 0}

into its own function(for checking whether or not you want to continue executing the proc)

do something like this:
mob
proc
Statup(obj/O as num)
set background=1
if(src.check_cancel()!=1)
return
//rest of code..
check_cancel()
if(src.Tessenka){return 0}
if(src.ByakuganUse){return 0}
if(src.SharinganUse){return 0}
if(src.usedhero){return 0}
if(src.MangekyouUse){return 0}
if(src.Cseal){return 0}
if(src.DemonUse){return 0}
if(src.shimon){return 0}
if(src.kyomon){return 0}
if(src.tomon){return 0}
if(src.sheimon){return 0}
if(src.keimon){return 0}
if(src.shomon){return 0}
if(src.kumon){return 0}
if(src.kaimon){return 0}
if(src.seimon){return 0}
else
return 1

bascially heres my problem i have it set up where when you invest stat point as a puppet master you should be able to invest points into puppeterying skill however when i tested this in game it did pop up on the list
In response to Daiguren Hyourinamru
You repeat yourself too much. That's going to make it terrible for debugging. You also should not be using goto, you should look into loops.
but the proc is being called by a verb so..
In response to IchiroKeisuke
IchiroKeisuke wrote:
If you want help you need to post a better description of your problem.

And also..

Break these large tasks up into smaller ones that are more manageable, so your code will be a lot cleaner and more maintainable.

for starters, you should probably put things like this:
            if(src.Tessenka){return 0}
> if(src.ByakuganUse){return 0}
> if(src.SharinganUse){return 0}
> if(src.usedhero){return 0}
> if(src.MangekyouUse){return 0}
> if(src.Cseal){return 0}
> if(src.DemonUse){return 0}
> if(src.shimon){return 0}
> if(src.kyomon){return 0}
> if(src.tomon){return 0}
> if(src.sheimon){return 0}
> if(src.keimon){return 0}
> if(src.shomon){return 0}
> if(src.kumon){return 0}
> if(src.kaimon){return 0}
> if(src.seimon){return 0}

into its own function(for checking whether or not you want to continue executing the proc)

do something like this:
> mob
> proc
> Statup(obj/O as num)
> set background=1
> if(src.check_cancel()!=1)
> return
> //rest of code..
> check_cancel()
> if(src.Tessenka){return 0}
> if(src.ByakuganUse){return 0}
> if(src.SharinganUse){return 0}
> if(src.usedhero){return 0}
> if(src.MangekyouUse){return 0}
> if(src.Cseal){return 0}
> if(src.DemonUse){return 0}
> if(src.shimon){return 0}
> if(src.kyomon){return 0}
> if(src.tomon){return 0}
> if(src.sheimon){return 0}
> if(src.keimon){return 0}
> if(src.shomon){return 0}
> if(src.kumon){return 0}
> if(src.kaimon){return 0}
> if(src.seimon){return 0}
> else
> return 1
>



if(var1||var2||var3||var4||..) return FALSE
return TRUE


If you're worried about the code being 'clean'.

Then, there's no need for '!=1'.

if(caller.proc())//checking for any return value that isn't null, 0, "", or any other variation of nothing
..//continue per needed


Also, if you're worried about his code being clean, it would make much more sense for him to use a switch() proc(or save a list of 'stat's the mob can upgrade, which I would recommend over the former) and then, instead of repeating the input selection copy/pasted for each clan/race/whateveryoucallit, call from the list you generate.

@OP
You're going to cause a lot of issues using goto here, I would recommend reading up on while() and switch().

However, your issue here is simply indentation.
            if(src.points<=0)
src.points=0
return
if(src.Clan=="Puppet Master"||src.Clan=="Human Puppet")
switch(input(src,"Distribute Points.","[src.points] Points left",text) in list ("Taijutsu","Genjutsu","Ninjutsu","Speed","Puppetry","Save for later"))