if (Result2 == "Potion of LongLife")
if(M in view(1,src))
for(var/obj/Items/Potions/S in M)
if(S.IsEmpty == 1)
for(var/obj/Items/gems/Diamond/F in M)
for(var/obj/Items/Silks/SpiderSilk/T in M)
var/fail
fail = prob(M.PotionSkill*4)
if(fail == 0)
usr<< "Failed!"
M.weight -= F.weight
del F
M.PotionSkill += 1
M.weight -= T.weight
del T
break
return
S.IsPotion = 1
S.IsEmpty = 0
S.icon_state = "RedPotion"
M.PotionSkill += 2
S.name = "Potion of LongLife"
M.weight -= T.weight
M.weight -= F.weight
del F
del T
break
return
Problem description:
As you can see this code makes a potion :) , but the problem is that for some reason it takes away two or more diamonds where as it should only take one away, is there anyway to fix this by any chace? I've tried using "break" but no effect.
What I tend to do with loops like this is put a Label at the bottom, and at the end of each loop of code, stick in a 'goto Label' line.