Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
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");
}
(This post was last modified: 07-27-2011, 03:49 AM by JetlinerX.)
|
|
07-27-2011, 03:46 AM |
|
xiphirx
Senior Member
Posts: 662
Threads: 16
Joined: Nov 2010
Reputation:
5
|
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
Sorry... what? I am totally new to scripting and I didnt understand any of that xD
|
|
07-27-2011, 03:52 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Scripting, need urgent help!
Ehhhhh... *brain explodes*
|
|
07-27-2011, 03:56 AM |
|
xiphirx
Senior Member
Posts: 662
Threads: 16
Joined: Nov 2010
Reputation:
5
|
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
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 ()
{
}
(This post was last modified: 07-27-2011, 06:46 AM by JetlinerX.)
|
|
07-27-2011, 06:40 AM |
|
xiphirx
Senior Member
Posts: 662
Threads: 16
Joined: Nov 2010
Reputation:
5
|
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 |
|
JetlinerX
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).
(This post was last modified: 07-27-2011, 07:20 AM by JetlinerX.)
|
|
07-27-2011, 06:59 AM |
|
|