ID:156939
 
Is there any way I can run a proc and let it complete before the client disconnects?
DisturbedSixx wrote:
Is there any way I can run a proc and let it complete before the client disconnects?

client/Del()
// Run Proc Here.
..()
In response to Maximus_Alex2003
I'm using Foomer's Display HUD and I'm trying to get the items to save and show up in the grid when loaded. Only way I found to do that was to load my contents into a separate list, delete the contents, and when loading my character to for() through the list and re-add every item back to contents. I believe that the client disconnects before the backup list is filled. Here's the code:
client
var/display_hud/backpack/backpack=new()

var/obj/hud_background/background=new()
New()
..()
src.screen+=src.background
Del()
mob.UpdateBackUp()
..()

var/list/backupcontents=list()

mob/proc
Relist()
src<<"[backupcontents.len] items in backup"
if(backupcontents.len!=0)
for(var/o in backupcontents)
src.client.backpack.Add(src, o, src.contents)
backupcontents.Remove(o)
else return
UpdateBackUp()
if(contents.len!=0)
for(var/o in contents)
backupcontents.Add(o)
src.client.backpack.Remove(src, o, src.contents)
contents=null
else return

Relist() is called on Loading.
In response to DisturbedSixx
I don't see why it wouldn't do it, but maybe add a return 1 and return 0 to it. So in the code, you can do:
if(mob.UpdateBackUp() == 1)
..()

So, if the proc returns 1, it does the default client/Del(). If not, it cancels. This may cause problems if the UpdateBackUp() has a runtime error or something like that, and returns 0. This would cause the client not to disconnect, so if it is really important that they leave, you might want to add:
else
..()

This way, even if the UpdateBackUp() messes up, the person doesn't stay in the game, potentially causing more errors.