ID:841848
 
(See the best response by Albro1.)
Code:
mob
proc
saveall()
for(var/mob/M in world)
if(!M.client)
return
M.SaveT()
sleep(1)
sleep(0)


mob
verb
Guardar_todas_las_partidas()
set category="Dueño"
src.SaveT()


Problem description:

Codigos\Naruto.dm:387:error: M.SaveT: undefined proc
Codigos\Naruto.dm:396:error: src.SaveT: undefined proc


******************************************************
My problem is this, I save all my games play in a single command that I close constantly and users often are AFK but when compiling tells me that the proc is not defined, I know what the proc thank you very much or if I can help to correct my mistake

Best response
You have to define SaveT(). Put this in your code:
mob/proc/SaveT()

You may want to use usr instead of src in your brazilian verb.
Also, your for() loop isn't going to work. You are using return in your client check, which is going to stop the whole loop on the first mob it finds without a client. Use continue instead, which skips the code and goes to the next iteration of the loop. One more thing: you don't need in world in the for() loop, because it searches the world by default.
mob/proc/saveall()
for(var/mob/m)
if(!m.client)
continue
m.SaveT()
// there shouldn't be any reason for you to have sleeps here. Take them out.
hi thanks for responding and for your help this is the result:

mob/proc/SaveT()
for(var/mob/M)
if(!M.client)
continue
M.SaveT()
world<<"<font size=1><font color=green><b>Se han guardado todas las partidas"

mob
verb
Guardar_Todas_Las_Partidas()
set category = "Enforcer"
src.SaveT()


compiles fine but after pressing the command ''guardar todas las partidas'' dram maker me off is not it good or bad sign, I hope you help me thank you very much.
You are going to create an infinite loop this way. You need to have a saveall() proc and a SaveT() proc. Keep the code as you had it (except change return to continue), and just add mob/proc/SaveT() to the code elsewhere. Tell SaveT() what to do (likely save their own mob).
hello and thanks again for your help this is the result

mob/proc/SaveT()

mob/proc/Saveall()
for(var/mob/M in world)
if(!M.client)
continue
M.SaveT()
world<<"<font size=1><font color=green><b>Se han guardado todas las partidas"


mob
verb

Guardar_Todas_Las_Partidas()
set category = "Enforcer"
src.Saveall()


and compiles perfect but when using it in the game does not give the results that does absolutely nothing I thank you very much again.

pdt: codes are in one file to change you and I do not care nothing happens
mob
verb
Save_Server()
set category="Enforcer"
SaveAll()

proc//Normal proc, NOT world, client, or mob
SaveAll()
for(var/mob/M in world)//Calls all mobs in world
if(M.client)//Applies command ONLY if it sees a client
M.Save()//This calls your players save verb
world<<"[usr] has saved all online characters."

Copy and use this the way it is and you shouldn't have any problems. By using it this way, it will gather all online players and save everyone's characters at once.
In response to Cyber Gaming
Cyber Gaming wrote:
> mob
> verb
> Save_Server()
> set category="Enforcer"
> SaveAll()
>
> proc//Normal proc, NOT world, client, or mob
> SaveAll()
> for(var/mob/M in world)//Calls all mobs in world
> if(M.client)//Applies command ONLY if it sees a client
> M.Save()//This calls your players save verb
> world<<"[usr] has saved all online characters."
>

Copy and use this the way it is and you shouldn't have any problems. By using it this way, it will gather all online players and save everyone's characters at once.

This has no difference from what he's already doing.

It does nothing because you have to tell SaveT() what to do. Right now it's calling SaveT() for every player, so make SaveT() save src.
I pulled that directly from my game so I know for a fact it works perfectly...

This is why I don't bother posting on here. Someone always has something negative to say in response...
In response to Cyber Gaming
Cyber Gaming wrote:
I pulled that directly from my game so I know for a fact it works perfectly...

This is why I don't bother posting on here. Someone always has something negative to say in response...

My response was that is has no difference from what he's already doing.

That actually isn't true. Your code, if taken, wouldn't work. You don't have Save() defined in your code. Your code just has a verb that calls a proc that loops through all the mobs in the world (which a for loop does anyways, so you don't need in world), and calls M.Save(). His code does this exact same thing. He just needs to tell his version of Save()(SaveT()) what to do.
In response to Albro1
thank you thank you very much Albro single was sent to do what I should do SaveT() ;-) Thnaks thanks so much (y)