Frictional Games Forum (read-only)

Full Version: Beginner help :o
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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!
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
I still get the same error message when trying to launch. : o
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()
{

}
(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...
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.

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
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.


(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
(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.

Pages: 1 2