Author Topic: Save character widget .  (Read 339 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Save character widget .
« on: May 04, 2011, 02:27:16 am »


               I found this on the vault.Cant get it to work for some reason. It is a save character widget. The tag is the same as script.

void i_save_char(){    // The object that activated the item    object oActivator = GetItemActivator();
    // The object that oActivator aimed the item at    object oTarget = GetItemActivatedTarget();
    // Only worry about saving players    if(TRUE == GetIsPC(oTarget))    {        // Do the save        ExportSingleCharacter(oTarget);
        // Notify the players that the save has taken place        if(oTarget == oActivator)        {            SendMessageToPC(oActivator, "Your player file has been saved.");        }        else        {            SendMessageToPC(oActivator, GetName(oTarget) + "'s player file has been saved.");            SendMessageToPC(oTarget, GetName(oActivator) + " has forced a save of your player file.");        }    }
    // Sass them just a bit if they do something silly    else    {        SendMessageToPC(oActivator, "Somehow I don't think " + GetName(oTarget) + " has a player file since ohhhhh... they are not a PLAYER.");    }}  // END ofvoid main()
               
               

               
            

Legacy_Evelath

  • Full Member
  • ***
  • Posts: 108
  • Karma: +0/-0
Save character widget .
« Reply #1 on: May 04, 2011, 03:57:56 am »


               Well, for one, your code is completely commented out...  I'll assume it's a formatting issue:


void main()
{


    // The object that activated the item
    object oActivator = GetItemActivator();
    // The object that oActivator aimed the item at
    object oTarget = GetItemActivatedTarget();
    // Only worry about saving players
    if(FALSE == !GetIsPC(oTarget))
    {
    // Do the save

    if(oTarget == oActivator)
    {
    ExportSingleCharacter(oActivator);
    SendMessageToPC(oActivator, "Your player file has been saved.");
    }
    else
    {
    SendMessageToPC(oActivator, GetName(oTarget) + "'s player file has been saved.");
    SendMessageToPC(oTarget, GetName(oActivator) + " has forced a save of your player file.");
    }
    }
    // Sass them just a bit if they do something silly
    else
    {
    SendMessageToPC(oActivator, "Somehow I don't think " + GetName(oTarget) + " has a player file since ohhhhh... they are not a PLAYER.");
    }
    }  // END ofvoid main()

This script is essentially overwritting the character file that you are currently using, rather than making a new entry.  That is what you want, yes?

EDIT: I made some minor adjustments, but it still works.
               
               

               


                     Modifié par Evelath, 04 mai 2011 - 02:58 .
                     
                  


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Save character widget .
« Reply #2 on: May 04, 2011, 04:12:21 am »


               Thanks Evelath