MasterWaffle Posted January 14, 2008 Share Posted January 14, 2008 I'm having trouble compiling a script. Every time I compile I get a message saying "Error: Undeclared Identifier 'oContainer' (and 'oLocker')". Can anyone tell me what I'm doing wrong? Script is below. SCRIPT: void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("metalbox033"))) { oContainer= CreateObject(OBJECT_TYPE_PLACEABLE, "metalbox033", Location(Vector(169.35, 132.94, 2.26), 00.0)); CreateItemOnObject("g_a_class4066", oLocker); CreateItemOnObject("g_i_belt002", oLocker); CreateItemOnObject("g_w_blstrpstl002", oLocker); CreateItemOnObject("g_i_pazcard_011", oLocker); CreateItemOnObject("g_i_upgrade002", oLocker); CreateItemOnObject("g_i_mask05", oLocker); } ExecuteScript("old_k_ptar_a10aa_en", OBJECT_SELF); } Link to comment Share on other sites More sharing options...
Stream Posted January 14, 2008 Share Posted January 14, 2008 You forgot to tell the script what oContainer & oLocker are, try this void main(){ object oConatiner = GetObjectbyTag("EnterTagHere"); object oLocker = GetObjectByTag("EnterTagHere"); object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("metalbox033"))) { CreateObject(OBJECT_TYPE_PLACEABLE,"metalbox033",Location(Vector(169.35, 132.94, 2.26), 00.0)); CreateItemOnObject("g_a_class4066", oLocker); CreateItemOnObject("g_i_belt002", oLocker); CreateItemOnObject("g_w_blstrpstl002", oLocker); CreateItemOnObject("g_i_pazcard_011", oLocker); CreateItemOnObject("g_i_upgrade002", oLocker); CreateItemOnObject("g_i_mask05", oLocker); } ExecuteScript("old_k_ptar_a10aa_en", OBJECT_SELF); } That should sort it out for you. --Stream Link to comment Share on other sites More sharing options...
MasterWaffle Posted January 14, 2008 Author Share Posted January 14, 2008 Thank you, that clears things up. Link to comment Share on other sites More sharing options...
stoffe Posted January 14, 2008 Share Posted January 14, 2008 I'm having trouble compiling a script. Every time I compile I get a message saying "Error: Undeclared Identifier 'oContainer' (and 'oLocker')". Can anyone tell me what I'm doing wrong? Script is below. There are three problems with your script. The first is that you have no closing block delimiter after the if-statement that checks if the container already exists. The second is that you have not declared either the oLocker or oContainer variables before you try to use them. The third is that you assign the object reference of the container to oContainer, which you then do nothing with, and instead try to create the items on a non-existing object since oLocker has not had any value assigned. So if I've understood correctly what you are trying to do: to make it work properly you check if the container does not exist. If it does not, you spawn it into the area and add a number of items to its inventory. Like: void main() { if (GetEnteringObject() == GetFirstPC()) { object oLocker = GetObjectByTag("metalbox033"); if (!GetIsObjectValid(oLocker)) { oLocker = CreateObject(OBJECT_TYPE_PLACEABLE, "metalbox033", Location(Vector(169.35, 132.94, 2.26), 00.0)); CreateItemOnObject("g_a_class4066", oLocker); CreateItemOnObject("g_i_belt002", oLocker); CreateItemOnObject("g_w_blstrpstl002", oLocker); CreateItemOnObject("g_i_pazcard_011", oLocker); CreateItemOnObject("g_i_upgrade002", oLocker); CreateItemOnObject("g_i_mask05", oLocker); } } ExecuteScript("old_k_ptar_a10aa_en", OBJECT_SELF); } Link to comment Share on other sites More sharing options...
MasterWaffle Posted January 16, 2008 Author Share Posted January 16, 2008 Thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.