Author Topic: merging is an issue  (Read 342 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
merging is an issue
« on: July 22, 2015, 06:00:49 am »


               

okay merging seems to be an issue for me (probably because I am doing something wrong here XD) But  I just implemented the guild quest system for my module/pw and I get an error on the last on_client_enter script:


 




#include "da_includefile_1"

#include "dmfi_init_inc"

#include "sha_subr_methds"

#include "persistance"

//  If your module's OnClientEnter has custom scripting, just paste the following into it.

//  Be sure to include the file "da_includefile_1" at the very top, as it is here.

int nQuest;

int nQuestState;

object oPassport;

object oPC;

 

void main()

{

{

    // find who just entered

    oPC = GetEnteringObject();

 

    // if they don't have a guild book, give them one

    if(GetItemByName("Guild Book", oPC) == OBJECT_INVALID)

        CreateItemOnObject("guildbook", oPC);

 

    // find the Passport object in the PC's inventory

    oPassport = GetItemByName("Passport", oPC);

 

    // if the PC has no passport, give them one

    if(oPassport == OBJECT_INVALID)

        oPassport = CreateItemOnObject("passport", oPC);

 

    // restore the journal from the quest

    // states stored on the passport's tag

 

    // NOTE - the quest tags must be named

    // in the format "1" for the first quest on the

    // passport tag, "2" for the second, etc.

 

    // loop through the passport tag, updating the journal

    for (nQuest = 1; nQuest < 32; nQuest++)

    {

        // get the existing quest state

        nQuestState = GetTagData(oPassport, nQuest);

 

        // if it's not zero, update the journal

        if(nQuestState != 0)

            AddJournalQuestEntry(IntToString(nQuest), nQuestState, oPC, FALSE, FALSE, TRUE);

    }

 

    // add the "message of the day" journal entry

    // (this also makes sure that the last "journal sound"

    // heard by the PC is the "ding" instead of the music)

    AddJournalQuestEntry("Message", 1, oPC, FALSE, FALSE, TRUE);

 

    // re-set the button for quests

    // SetPanelButtonFlash(oPC, PANEL_BUTTON_JOURNAL, FALSE);

 

}

 SetLocalInt(GetEnteringObject(), "nRestingCounterPC", 100); // (100) number of rounds between rest must be same as on OnModRest

 

int iPUNISHMENT = TRUE;   //Change this to FALSE to turn *off* the module's auto-punishment for criminals who try to log off and on again to evade punishment.

object DA_oMODULE = GetModule();

object DA_oPC = GetEnteringObject();

object DA_oAREA = GetArea(DA_oPC);

object DA_oPITMASTER = GetObjectByTag("da_pitmaster");

object DA_oPIT = GetArea(DA_oPITMASTER);

object DA_oWP_ENTRANCE = GetWaypointByTag("da_wp_entrance");

int iENFORCER = GetIsEnforcer(DA_oPC);

int iEXEMPT = GetIsExempt(DA_oPC);

string DA_sNAME = GetName(DA_oPC);

string DA_sUSERID = GetPCPlayerName(DA_oPC);

 

DeleteLocalInt(DA_oPC, "da_slot");

DeleteLocalInt(DA_oPC, "da_Team");

 

if (iENFORCER == TRUE)   //Place an Enforcer Key in the inventory of every Enforcer who doesn't yet have one.

 {

  int iHASKEY = FALSE;

  string sKEY = "da_enforcerkey";

  object oITEM = GetFirstItemInInventory(DA_oPC);

  while (GetIsObjectValid(oITEM))

   {

    string sITEM = GetTag(oITEM);

    string sITEMLEFT14 = GetStringLeft(sITEM, 14);

    if (sITEMLEFT14 == sKEY)

      iHASKEY = TRUE;

    oITEM = GetNextItemInInventory(DA_oPC);

   }

  if (iHASKEY == FALSE)

   {

    CreateItemOnObject("da_enforcerkey", DA_oPC);

    SendMessageToPC(DA_oPC, "You might find this item useful; please hold on to it.");

   }

 }

else   //Destroy all Enforcer Keys in the inventory of non-authorized enforcers.

 {

  string sKEY = "da_enforcerkey";

  object oITEM = GetFirstItemInInventory(DA_oPC);

  while (GetIsObjectValid(oITEM))

   {

    string sITEM = GetTag(oITEM);

    string sITEMLEFT14 = GetStringLeft(sITEM, 14);

    if (sITEMLEFT14 == sKEY)

     {

      DestroyObject(oITEM);

      SendMessageToPC(DA_oPC, "You are not authorized to carry an Enforcer Key; it has been destroyed.");

     }

    oITEM = GetNextItemInInventory(DA_oPC);

   }

 }

 

if (iEXEMPT == TRUE)

  DeleteLocalInt(DA_oMODULE, "da_" + DA_sNAME + DA_sUSERID);  //Make sure no exempt player is counted as punishable.

int iJAIL = GetLocalInt(DA_oMODULE, "da_" + DA_sNAME + DA_sUSERID);

if (iJAIL == TRUE && iPUNISHMENT == TRUE)

 {

  int iPRIORXP = GetXP(DA_oPC);

  int iXPHIT = iPRIORXP/10;

  int iPOSTXP = iPRIORXP - iXPHIT;                     //Take 10% of the criminal's XP.

  SetXP(DA_oPC,iPOSTXP);                               //Default punishment is 5%; the other 5% is for logging off and on again.

  object oITEM = GetFirstItemInInventory(DA_oPC);

  while (GetIsObjectValid(oITEM))

   {

    DestroyObject(oITEM);                              //Destroy all items in the criminal's inventory.

    oITEM = GetNextItemInInventory(DA_oPC);

   }

  oITEM = GetItemInSlot(INVENTORY_SLOT_ARMS, DA_oPC);  //Destroy all equipped items.

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_ARROWS, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_BELT, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_BOLTS, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_BOOTS ,DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_BULLETS, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_CHEST, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_CLOAK,DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_HEAD,DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_LEFTRING, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_NECK, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  oITEM = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, DA_oPC);

  if (GetIsObjectValid(oITEM))

    DestroyObject(oITEM);

  int iGP = GetGold(DA_oPC);

  AssignCommand(DA_oPC, TakeGoldFromCreature(iGP, DA_oPC, TRUE));         //Take the criminal's gold.

  object oGARB = CreateItemOnObject("da_prsngrb", DA_oPC);        //Make the criminal don prison garb.

  DelayCommand(0.1, AssignCommand(DA_oPC, ActionEquipItem(oGARB, INVENTORY_SLOT_CHEST)));

  DelayCommand(10.0, FloatingTextStringOnCreature("You're still a criminal; leaving & coming back won't help.", DA_oPC, FALSE));  //Verbal reprimand.

 }

    object oUser = GetEnteringObject();

 

    // do any other module OnClientEnter work here

    ExecuteScript("x3_mod_def_enter", OBJECT_SELF);

 

    // initialize DMFI

    dmfiInitialize(oUser);

 

     SubraceOnClientEnter();

}

    // find who just entered

    oPC = GetEnteringObject();

 

    // if they don't have a guild book, give them one

    if(GetItemByName("Guild Book", oPC) == OBJECT_INVALID)

        CreateItemOnObject("guildbook", oPC);

 

    // find the Passport object in the PC's inventory

    oPassport = GetItemByName("Passport", oPC);

 

    // if the PC has no passport, give them one

    if(oPassport == OBJECT_INVALID)

        oPassport = CreateItemOnObject("passport", oPC);

 

    // restore the journal from the quest

    // states stored on the passport's tag

 

    // NOTE - the quest tags must be named

    // in the format "1" for the first quest on the

    // passport tag, "2" for the second, etc.

 

    // loop through the passport tag, updating the journal

    for (nQuest = 1; nQuest < 32; nQuest++)

    {

        // get the existing quest state

        nQuestState = GetTagData(oPassport, nQuest);

 

        // if it's not zero, update the journal

        if(nQuestState != 0)

            AddJournalQuestEntry(IntToString(nQuest), nQuestState, oPC, FALSE, FALSE, TRUE);

    }

 

    // add the "message of the day" journal entry

    // (this also makes sure that the last "journal sound"

    // heard by the PC is the "ding" instead of the music)

    AddJournalQuestEntry("Message", 1, oPC, FALSE, FALSE, TRUE);

 

    // re-set the button for quests

    // SetPanelButtonFlash(oPC, PANEL_BUTTON_JOURNAL, FALSE);

}

}

 



 



 



               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
merging is an issue
« Reply #1 on: July 22, 2015, 06:40:58 am »


               

If you have a lot of scripts to merge, you're going to need to learn some of the basics. We don't mind helping (fixing scripts flexes your brain muscles!), but the goal is for you to learn to do it on your own.


 


For starters, check out the Lexicon's article on compiler error messages to see where your problems lie. I'll give you a hint: check your curly brackets to see how the code is structured. Following good indentation style will probably help with tracking this down.