Frictional Games Forum (read-only)
Beginner help :o - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Beginner help :o (/thread-12883.html)

Pages: 1 2


Beginner help :o - FinBanana - 01-26-2012

PHP Code:
// This runs when the map is started

     
void OnStart()
    {
    
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);

     
     if(
ScriptDebugOn())
          {
               
GiveItemFromFile("lantern""lantern.ent");
               
SetPlayerLampOil(100.0f);
 
               for(
int i 0;10;i++)
               {
                    
GiveItemFromFile("tinderbox""tinderbox.ent");
               }
          }
     }
    
    
void OpenCabinet(stringasNamefloat afState)
    {
    
SetMoveObjectState("cabinet_nice_1"1);
    }
    
     
//===========================================
     // This runs when the player enters the map
     
void OnEnter()
     {
     }
 
     
//===========================================
     // This runs when the player leaves the map
     
void OnLeave()
     {
     
     } 


So, I have this script that should open the cabinet (cabinet_nice_1) when I enter the area (Script_Area1).
When I try to launch the map, i get a "FATAL ERROR" window saying:
" main (5,2) : ERR : No matching signatures to 'AddEntityCollideCallBack(string@&, string@&, string@&, const bool, const uint)' "
Any help would be appreciated.
Thanks!



RE: Beginner help :o - Tripication - 01-26-2012

incorrect syntax, use this insted

// This runs when the map is started

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);


if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}



Not sure it will fix the main issue, but surely solves a future issue


RE: Beginner help :o - FinBanana - 01-26-2012

I still get the same error message when trying to launch. : o



RE: Beginner help :o - SilentStriker - 01-26-2012

It's because it's missing a }

Use this

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}



RE: Beginner help :o - Tripication - 01-26-2012

(01-26-2012, 05:01 PM)SilentStriker Wrote: It's because it's missing a }

Use this

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}



Erm, not sure that'll work either...


RE: Beginner help :o - flamez3 - 01-26-2012

If it says that it doesnt reconize AddEntityCollideCallback it either means you torrented the game and it doesnt have all the files or you need to space out the "" and the , Like this:

AddEntityCollideCallBack("Player", "Script_Area1", "OpenCabinet", true, 1);

(01-26-2012, 05:01 PM)SilentStriker Wrote: It's because it's missing a }

Use this

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

He's not. There is already a closing bracket. It's something to do with the callback itself.




RE: Beginner help :o - Tripication - 01-26-2012

ok, im seeing a few errors here. I'll try one more time...

void OnStart()
{
AddEntityCollideCallBack("Player", "Script_Area1", "OpenCabinet", true, 1);
}


void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}



Try removing anything you dont really need for testing, just put a temporary lantern down and you should automatically start off with full oil, if not.


SetPlayerLampOil(100.0f)
(01-26-2012, 05:05 PM)flamez3 Wrote: If it says that it doesnt reconize AddEntityCollideCallback it either means you torrented the game and it doesnt have all the files or you need to space out the "" and the , Like this:

AddEntityCollideCallBack("Player", "Script_Area1", "OpenCabinet", true, 1);

(01-26-2012, 05:01 PM)SilentStriker Wrote: It's because it's missing a }

Use this

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

He's not. There is already a closing bracket. It's something to do with the callback itself.
and this shouldnt matter, he should still be able to run this function if it is used thousands of times in the normal game


RE: Beginner help :o - FinBanana - 01-26-2012

Yeah, I tried it with

{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

and it told me about "unexpected token 'if'.


I do have all the needed files because i bought the game at frictionalgames.com
I tried it with and without the spaces between the " and , but still I get the same error. :/
EDIT: and yeah, I removed the part giving the lantern and still the same error.
Thanks anyway and thanks in advance.





RE: Beginner help :o - Tripication - 01-26-2012

(01-26-2012, 05:19 PM)FinBanana Wrote: Yeah, I tried it with

{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

and it told me about "unexpected token 'if'.


I do have all the needed files because i bought the game at frictionalgames.com
I tried it with and without the spaces between the " and , but still I get the same error. :/
Thanks anyway and thanks in advance.
do exactly that, with nothing else. So remove this


if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}



and have only this in your ENTIRE script for now.


void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}



void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}



That should work perfectly assuming all the names of the entities and areas are correct


RE: Beginner help :o - flamez3 - 01-26-2012

(01-26-2012, 05:08 PM)Tripication Wrote: ok, im seeing a few errors here. I'll try one more time...

void OnStart()
{
AddEntityCollideCallBack("Player", "Script_Area1", "OpenCabinet", true, 1);
}


void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}



Try removing anything you dont really need for testing, just put a temporary lantern down and you should automatically start off with full oil, if not.


SetPlayerLampOil(100.0f)
(01-26-2012, 05:05 PM)flamez3 Wrote: If it says that it doesnt reconize AddEntityCollideCallback it either means you torrented the game and it doesnt have all the files or you need to space out the "" and the , Like this:

AddEntityCollideCallBack("Player", "Script_Area1", "OpenCabinet", true, 1);

(01-26-2012, 05:01 PM)SilentStriker Wrote: It's because it's missing a }

Use this

void OnStart()
{
AddEntityCollideCallBack("Player","Script_Area1","OpenCabinet",true,1);
}

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

void OpenCabinet(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("cabinet_nice_1", 1);
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

He's not. There is already a closing bracket. It's something to do with the callback itself.
and this shouldnt matter, he should still be able to run this function if it is used thousands of times in the normal game

No matching signatures to 'AddEntityCollideCallBack(string@&, string@&, string@&, const bool, const uint)' means that his callback is not the correct callback, regardless if he used another one before.