ID:148842
 
mob/pet
density = 0
var/petowner
proc/Petstart()
loopyloop
step_to(src,petowner,1)
sleep(0)
goto loopyloop


mob/verb/Custom_Pet(M as mob in world,arg as icon)
var/mob/pet/P = new /mob/pet(usr.loc)
var/choice = input("What kind of pet?","Pet Setup") in list("Custom")
if(choice == "Custom") {
P.icon_state = input("Icon State?")
P.icon = arg
P.name = input("Pet name?")
P.petowner = M
P:Petstart()
}
Nunugi wrote:
mob/pet
density = 0
var/petowner
proc/Petstart()
loopyloop
step_to(src,petowner,1)
sleep(0)
goto loopyloop

Lets just say that "sleep(0)" isn't much of a delay. Try a larger number.

Remember, the more often a loop repeats, the more lag it will cause.
Nunugi wrote:
mob/pet
density = 0
var/petowner
proc/Petstart()
loopyloop
step_to(src,petowner,1)
sleep(0)
goto loopyloop

Here's your problem. The loop will continually execute, sucking up as much available CPU time as it possibly can. Adding a small delay in the sleep would help immediately. But even better would be a bit of a redesign to be much more efficient.

I assume you want a new pet to walk to its owner and then follow the owner around thereafter, right? First let's do the part about walking to the owner:
mob/pet/proc/Petstart()
walk_to(src, petowner)


That's all you need for that part. Now, to have the pet follow the owner around, the most efficient way is to have the pet move only when the owner moves. This is much better than checking every single tick like your loop did above. To do this, all you need to do is put the code in mob/Move(). You'll also need to keep a list of each player's pets.
mob/var/petlist[0]

mob/verb/Custom_Pet(M as mob in world,arg as icon)
var/mob/pet/P = new /mob/pet(usr.loc)
var/choice = input("What kind of pet?","Pet Setup") in list("Custom")
if(choice == "Custom")
P.icon_state = input("Icon State?")
P.icon = arg
P.name = input("Pet name?")
P.petowner = M
M.petlist += P
P.Petstart()

mob/Move()
. = ..()
for (var/mob/pet/P in src.petlist)
walk_to(P, src)
Nunugi wrote:
mob/pet
density = 0
var/petowner
proc/Petstart()
loopyloop
step_to(src,petowner,1)
sleep(0)
goto loopyloop

The advice of the others is good, but I thought I'd add some: You should never use goto when an ordinary while() or for() loop will suffice. 99% of the time, you should be able to use a loop structure instead.

In this case, what you want is simply a while() loop that will run forever:
proc/Petstart()
while(1)
step_to(src,petowner,1)
sleep(4)

Or better still:
proc/Petstart()
step_to(src,petowner,1)
spawn(4) Petstart()

Lummox JR