ID:146213
 
Code:
        RecipeVendor
icon = 'vendor1.dmi'
density = 1
DblClick()
var/mob/player/M
for(M as mob in get_step(src,src.dir))
usr.nomotion=1
switch(input("Varsuvio: Nyeh. Welcome to me store, young whippersnapper.","")in list("Buy","Sell","Leave"))
if("Buy")
var/Buying = input("What would you like?")in list("Make Lumber Recipe (500GP)","Leave")
if(Buying == "Make Lumber Recipe (500GP)")
if(usr.gold >= 500)
usr.gold -= 500
new/obj/recipes/MakeLumberRecipe(usr)
usr<<"You have purchased a Make Lumber recipe!"
usr.nomotion=0
else
usr.nomotion=0
if("Sell")
for(var/obj/recipes/O in usr)
if(locate(O) in usr)
switch(alert("Are you sure you want to sell [O] for [O.price] gold?","Selling","Yes","No"))
if("Yes")
usr.gold += O.price
usr<<"You have sold your [O] for [O.price]"
del(O)
usr.nomotion=0
else
usr.nomotion=0
else
usr << "You don't have anything to sell!"
usr.nomotion=0
else
usr.nomotion=0


Problem description: Everything aside from the fact that if there's nothing in usr to sell, it doesn't set usr's nomotion to 0, is okay.

Sinoflife wrote:
Problem description: Everything aside from the fact that if there's nothing in usr to sell, it doesn't set usr's nomotion to 0, is okay.

That's because, "nomotion=0" is under the loop. If there's nothing to loop through - then the loop won't even begin.
In response to Teh Governator
Teh Governator wrote:
Sinoflife wrote:
Problem description: Everything aside from the fact that if there's nothing in usr to sell, it doesn't set usr's nomotion to 0, is okay.

That's because, "nomotion=0" is under the loop. If there's nothing to loop through - then the loop won't even begin.

So what exactly are you saying I should do?
I mean, the if(locate(O) in usr) else usr.nomotion=0 should get it, I'd think.
In response to Sinoflife
Sinoflife wrote:
Teh Governator wrote:
Sinoflife wrote:
Problem description: Everything aside from the fact that if there's nothing in usr to sell, it doesn't set usr's nomotion to 0, is okay.

That's because, "nomotion=0" is under the loop. If there's nothing to loop through - then the loop won't even begin.

So what exactly are you saying I should do?
I mean, the if(locate(O) in usr) else usr.nomotion=0 would get it.

No because, it's still not looping.
In response to Teh Governator
Again, what should I do?
I have absolutely no idea as to what you mean when you say "It's not looping".
Sinoflife wrote:
            if("Sell")
var/list/Items=list()
for(var/obj/recipes/O in usr)
Items.Add(O)
var/obj/O=input(usr,"Which item do you wish to sell?","[src.name]") as anything|null in Items
if(O)
switch(alert("Are you sure you want to sell [O.name] for [O.price] gold?","Selling","Yes","No"))
if("Yes")
usr.gold += O.price
usr<<"You have sold your [O] for [O.price]"
del(O)
else
usr << "You don't have anything to sell!"
usr.nomotion=0
In response to Teh Governator
Thanks, it worked.
Just as a note or whatever, anything should've been to the right of |.