Frictional Games Forum (read-only)

Full Version: Script order?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, i have a question. If a have a message before a door unlock in my script, why cant i use the key before i see the message? is it just me being retard? :p
Could you post the script please?
(03-10-2013, 10:33 AM)Smoke Wrote: [ -> ]Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}
(03-10-2013, 10:43 AM)mrsomeepicrandomguy Wrote: [ -> ]
(03-10-2013, 10:33 AM)Smoke Wrote: [ -> ]Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}

The script is a mess. Are you sure this is your full script ?
(03-10-2013, 10:47 AM)No Author Wrote: [ -> ]
(03-10-2013, 10:43 AM)mrsomeepicrandomguy Wrote: [ -> ]
(03-10-2013, 10:33 AM)Smoke Wrote: [ -> ]Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}

The script is a mess. Are you sure this is your full script ?
Yes, Its kinda messy but it does what it should, just that i have to walk into the message area befor i can unlock the door.
Have you tested it ?
(03-10-2013, 11:10 AM)No Author Wrote: [ -> ]Have you tested it ?
Yes, everything works, but you have to do it in order, and I don't want that.
I'm very confused right now.
Cuz, the script you post has a void Message on the void OnStart, there's a double "}" on the void OnStart, AND the game doesn't give an error because of that.
(03-10-2013, 11:27 AM)No Author Wrote: [ -> ]I'm very confused right now.
Cuz, the script you post has a void Message on the void OnStart, there's a double "}" on the void OnStart, AND the game doesn't give an error because of that.
Thats weird.. know when i looked at it you right. Don't really know what my game is doing..
Try do it like this.

void OnStart()
{
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}

void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}

void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
}

void OnLeave()
{

}
Pages: 1 2