ID:146169
 
Code:
        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.

You have some lines after your while(time) loop that appear to belong inside it, yet they're outside after the loop has finished. This loop doesn't sleep, and it doesn't decrement time, so it keeps looping forever and using all the cycles of your game. The game shouldn't lock up for good, though, because eventually DS will discover it's in an infinite loop, unless you turned off loop_checks which is a bad thing to do.

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