Start_Auction()
if(biditem)
src<<"There is currently an auction in place."
return
var/obj/O=input("What item would you like to auction?","Auction Item")as null|obj in src
if(!O)
return
var/startbid=input("What number would you like to start the bidding at?","Bidding Price")as null|num
if(!startbid)
return
if(startbid<=0)
src<<"The starting bid must be higher than 0 gold."
return
else
highbid=startbid
biditem="\ref[O]"
ownbidder="\ref[src]"
O.loc = locate(/turf/fun/)
world<<"[src] has started an auction for their [O.name]. Starting bid is [startbid]."
time=10
while(time)
if(auctstop)
world<<"[src] has stopped the auction."
auctstop=null
return
if(auctstop2)
world<<"[src] has stopped the auction."
time=0
auctstop2=null
break
sleep(10)
if(time==1)
time--
sleep(10)
else
time--
if(!time&&!highbidder)
world<<"The auction has ended. Nobody has bid on the item and it will return to the owner."
var/obj/Item = locate(biditem)
Item.loc=src
if(!time&&highbidder)
var/mob/M = locate(highbidder)
world<<"[M] has won the auction with a bid of [highbid] gold!"
var/obj/Item = locate(biditem)
Item.loc=M
M.gold-=highbid
src.gold+=highbid
highbid=null
highbidder=null
biditem=null
auctstop=null
auctstop2=null
ownbidder=null
Problem description: Whenever someone uses this verb, the game locks up. No idea why.
The if(time==1) line is totally wrong and should go away. So should the second sleep(10).
while(time) should be while(time>0). Likewise at the bottom all the if(!time) checks should be if(time<=0).
Lummox JR