I think his problem is that he has a script that changes the name of the player, sleeps for a time and then sets the name back. However, if the character goes offline and the script finishes sleeping and attempts to restore the old name, it gets an error because the character is offline.
Take, for example, the incognito spell. This is the code for the incognito spell in 095:
Code: Select all
program incognito(parms)
var caster := parms.caster;
if (!GetObjProperty( caster, "realname"))
SetObjProperty( caster, "realname", caster.name );
endif
var newName := AssignName(caster);
SetName( caster, newName );
PlaySoundEffect(caster, 0x1e1);
Detach();
set_critical(1);
sleep( 60 * CInt(GetEffectiveSkill( caster, SKILLID_MAGERY )/10 ) );
SetName( caster, GetObjProperty( caster, "realname" ) );
EraseObjProperty( caster, "realname" );
endprogram
If realname already exists then the player has incognito on them already and is casting it again so don't over write it. It sleeps for a time dependant on the player's magic skill and then resets the name and erases the object property. However, if the mobile is offline you get an error.
In the corrected example, it stores the casters serial while they're online and if they become offline by the end of the script, it gets an offline mobile refrence to them so changes can be made. Here is the corrected code:
Code: Select all
program incognito(parms)
var caster := parms.caster;
if (!GetObjProperty( caster, "realname"))
SetObjProperty( caster, "realname", caster.name );
endif
var newName := AssignName(caster);
SetName( caster, newName );
PlaySoundEffect(caster, 0x1e1);
Detach();
var casterSerial := caster.serial;
Sleep(60 * CInt(GetEffectiveSkill( caster, SKILLID_MAGERY )/10 ));
// If you try to do something to a mobile when they're offline you get this error:
// error{ errortext = "Mobile is offline" }
if (!caster.connected)
caster := SystemFindObjectBySerial( casterSerial, SYSFIND_SEARCH_OFFLINE_MOBILES );
endif
SetName( caster, GetObjProperty( caster, "realname" ) );
EraseObjProperty( caster, "realname" );
endprogram
So you don't even need to use logon, logoff, reconnect, etc...