Author Topic: Error:- Variable Defined Without Type  (Read 419 times)

Legacy_Willowy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Error:- Variable Defined Without Type
« on: September 12, 2011, 01:03:34 pm »


               Small problem with the following script, it will not compile.  How and where  should I define the variable  (GetIsObjectValid(oItem)).

Thanks:)

1   /*
2   script_01
3   Usage:- OnAction_Conversation Editor
4   */
5
6   #include "nw_i0_tool"
7
8   void main()
9
10  {
11  get player
12  object oPC = GetPCSpeaker();
13
14  //reward
15  RewardPartyXP(2500, oPC, FALSE);
16  RewardPartyGP(10000, oPC, FALSE);
17
18  //remove quest item from PC
19  object oTarget;
20  oTarget = GetItemPossessedBy(oPC, "Quest_Item");
21
22  if (GetIsObjectValid(oItem))
23
24  // destroy "Quest_Item"
25  DestroyObject(oItem);
26  }

/*
Error. 'script_01' did not compile.
script_01.nss(22): ERROR: VARIABLE DEFINED WITHOUT TYPE
*/
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Error:- Variable Defined Without Type
« Reply #1 on: September 12, 2011, 01:18:16 pm »


               line 19 and 20

change from
object oTarget;
oTarget = GetItemPossessedBy(oPC, "Quest_Item");

to
object oItem = GetItemPossessedBy(oPC, "Quest_Item");
               
               

               


                     Modifié par Lightfoot8, 12 septembre 2011 - 12:19 .
                     
                  


            

Legacy_Willowy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Error:- Variable Defined Without Type
« Reply #2 on: September 12, 2011, 02:42:29 pm »


               Thanks you, that did the job.

Talk about not seeing the woods for the trees!:pinched:Too many late nights me thinks.