Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 5 Vote(s) - 3.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting, need urgent help!
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#91
RE: Scripting, need urgent help!

There is no SetEntityCallbackFunc. SetEntityCollideCallback? I don't know what you're doing, but if it is a SetEntityCollideCallback, it would look like this:

SetEntityCollideCallback("Player", "notethree", "Func", true, 1);

:/

07-27-2011, 03:31 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#92
RE: Scripting, need urgent help!

Hm, now I get errors on 13,25 and 15,1. Full code, I am trying to get sounds to play, and the player to be forced to look up.

}
SetEntityCollideCallback("Player", "notethree", "Func", true, 1);
void Func(string &in asEntity, string &in type)
if(type == "OnPickup")
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
StartPlayerLookAt(string& Player,3,3,"");
AddTimer("atticscare", 1, "Func2");
}

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-27-2011, 03:49 AM by JetlinerX.)
07-27-2011, 03:46 AM
Website Find
xiphirx Offline
Senior Member

Posts: 662
Threads: 16
Joined: Nov 2010
Reputation: 5
#93
RE: Scripting, need urgent help!

Uhm... where's your syntax?

SetEntityCollideCallback should be in a function, not out on its own.

After you declare a function header you need to open brackets ( {} ) and encapsulate your commands within it...

07-27-2011, 03:50 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#94
RE: Scripting, need urgent help!

Sorry... what? I am totally new to scripting and I didnt understand any of that xD

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-27-2011, 03:52 AM
Website Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#95
RE: Scripting, need urgent help!

(07-27-2011, 03:50 AM)xiphirx Wrote: Uhm... where's your syntax?

SetEntityCollideCallback should be in a function, not out on its own.

After you declare a function header you need to open brackets ( {} ) and encapsulate your commands within it...

Excuse you smart ass, of course it should be in a function. He's going to have to replace SetEntityCallbackFunc("notethree", "Func"); with SetEntityCollideCallback("Player", "notethree", "Func", true, 1); so it should already be in a function. -_-

07-27-2011, 03:54 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#96
RE: Scripting, need urgent help!

Ehhhhh... *brain explodes*

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-27-2011, 03:56 AM
Website Find
xiphirx Offline
Senior Member

Posts: 662
Threads: 16
Joined: Nov 2010
Reputation: 5
#97
RE: Scripting, need urgent help!

(07-27-2011, 03:54 AM)Kyle Wrote:
(07-27-2011, 03:50 AM)xiphirx Wrote: Uhm... where's your syntax?

SetEntityCollideCallback should be in a function, not out on its own.

After you declare a function header you need to open brackets ( {} ) and encapsulate your commands within it...

Excuse you smart ass, of course it should be in a function. He's going to have to replace SetEntityCallbackFunc("notethree", "Func"); with SetEntityCollideCallback("Player", "notethree", "Func", true, 1); so it should already be in a function. -_-

*sigh*


JetlinerX:

You don't have any form to your code...
}
SetEntityCollideCallback("Player", "notethree", "Func", true, 1);
void Func(string &in asEntity, string &in type)
if(type == "OnPickup")
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
StartPlayerLookAt(string& Player,3,3,"");
AddTimer("atticscare", 1, "Func2");
}

Is what you posted.

SetEntityCollideCallback("Player", "notethree", "Func", true, 1);

Should be inside of one of the predefined functions (something like OnEnter) not out on its own (global scope, which basically means its not contained within brackets)

So...
void OnEnter()
{
    SetEntityCollideCallback("Player", "notethree", "Func", true, 1);    
}

Like that.

Now, moving on...
void Func(string &in asEntity, string &in type)
if(type == "OnPickup")
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
StartPlayerLookAt(string& Player,3,3,"");
AddTimer("atticscare", 1, "Func2");
}

You're missing the brackets for the function here:
void Func(string &in asEntity, string &in type)
{
    if(type == "OnPickup")
    {
        PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
        PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
        StartPlayerLookAt(string& Player,3,3,"");
        AddTimer("atticscare", 1, "Func2");
    }
}

(as a side note, you always want to indent your code, it makes it easier to read)

also, you have an error in your "StartPlayerLookAt" function call...
StartPlayerLookAt(string& Player,3,3,"");

you don't need to include the type of value when you pass it as a parameter, this is why you do it in the function's declaration or prototype.

StartPlayerLookAt("Player", 3.0f, 3.0f, "");

Overall, I would REALLY suggest just getting the basics down of C++, syntax wise as it seems to be your only problem...

07-27-2011, 05:37 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#98
RE: Scripting, need urgent help!

Wow... you know, I appreciate the help, but maybe a little less attitude would be nice. However, I am still getting an error that says: Unexpected End of File. My CURRENT code:

void OnEnter ()
{
AddUseItemCallback("", "keyone", "door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door1", 0, false);
RemoveItem("keyone");
{
SetEntityCollideCallback("Player", "notethree", "Func", true, 1);
}
{
if(type == "OnPickup")
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
StartPlayerLookAt("Player", 3.0f, 3.0f, "");
AddTimer("atticscare", 1, "Func2");
}
}
void OnLeave ()
{
}

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-27-2011, 06:46 AM by JetlinerX.)
07-27-2011, 06:40 AM
Website Find
xiphirx Offline
Senior Member

Posts: 662
Threads: 16
Joined: Nov 2010
Reputation: 5
#99
RE: Scripting, need urgent help!

(07-27-2011, 06:40 AM)JetlinerX Wrote: Wow... you know, I appreciate the help, but maybe a little less attitude would be nice. However, I am still getting an error that says: Unexpected End of File. My CURRENT code:

void OnEnter ()
{
AddUseItemCallback("", "keyone", "door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door1", 0, false);
RemoveItem("keyone");
{
SetEntityCollideCallback("Player", "notethree", "Func", true, 1);
}
{
if(type == "OnPickup")
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
StartPlayerLookAt("Player", 3.0f, 3.0f, "");
AddTimer("atticscare", 1, "Func2");
}
}
void OnLeave ()
{
}

What attitude?

Also, you have stray brackets... not sure what they're for..?

void OnEnter ()
{
    AddUseItemCallback("", "keyone", "door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("door1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "door1", 0, false);
    RemoveItem("keyone");
{ <---- STRAY BRACKET
    SetEntityCollideCallback("Player", "notethree", "Func", true, 1);    
}
{ <---- STRAY BRACKET

WHERE IS THIS SUPPOSED TO BE?...
    if(type == "OnPickup")
    {
        PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
        PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
        StartPlayerLookAt("Player", 3.0f, 3.0f, "");
        AddTimer("atticscare", 1, "Func2");
    }
} < ---- STRAY BRACKET
void OnLeave ()
{
}

if(type == "OnPickup")
   {
       PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false);
       PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false);
       StartPlayerLookAt("Player", 3.0f, 3.0f, "");
       AddTimer("atticscare", 1, "Func2");
   }

You need to associate this with a function, it cant be in the global scope by itself.

07-27-2011, 06:52 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
RE: Scripting, need urgent help!

Okay, what exactly is a function (with example of one used in this situation please) Sorry.

EDIT: Unexpected token on 15,5. But when token (if).

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-27-2011, 07:20 AM by JetlinerX.)
07-27-2011, 06:59 AM
Website Find




Users browsing this thread: 3 Guest(s)