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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Basic Light change wont work... please help
reper1210 Offline
Junior Member

Posts: 18
Threads: 7
Joined: Mar 2012
Reputation: 0
#1
Basic Light change wont work... please help

I'm new to scripting and i've tired for three days to get a single light to go out when i walk into a specified area and i keep getting this error...


FATAL ERROR: Could not load script file 'custom_stories/confined/Maps/confined.hps'!
main (3, 1) : ERR : No matching signatures to 'AddEntityCollideCallback(string@&, string@&, string@&, string@&)'
main (19, 28) : ERR : Expected '('


And this is my script...


void OnStart()
{
AddEntityCollideCallback("Enter","Player","ScriptArea_1","TurnOffLight");
AddDebugMessage("OnStart!", false);
}

void OnEnter()
{
AddDebugMessage("OnEnter!", false);
}

void OnLeave()
{
AddDebugMessage("OnLeave!", false);
}

void TurnOffLight(string asParent, string asChild)
{
void SetLightVisible(string& Light, true);
}

In game i have an area called "ScriptArea_1" and a ceiling lamp called "Light". I've been following tutorials all over frictional games and i tried to do the tutorial "5.1 scripting a light" the exact way and that didn't work and could not find matching signatures either or w/e.
This script does function because the debugging works and before i tested auto changing maps and giving my a lantern to start with with also both worked.

I appreciate any help in advance if anyone is will to try and solve this.
03-29-2012, 06:08 PM
Find Reply
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#2
RE: Basic Light change wont work... please help

Your AddEntityCollideCallback has no spaces between the commas and the abDeleteOnCollide and alStates are missing. Your callback syntax is wrong too and should be void TurnOffLight(string &in asParent, string &in asChild, int alState) Check this out:

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
alState: 1 = enter, -1 = leave
asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both

-----------------
In your case with the lamp, you should use:
SetLampLit(string& asName, bool abLit, bool abEffects); in stead of
SetLightVisible(string& asLightName, bool abVisible); , (there is a difference between lamps and lights) do not forget to put in your lights internal name at "string& asName".
-----------------
Change all the red stuff:

void OnStart()
{
AddEntityCollideCallback("Player", "Script_area_name", "Function_to_call", true, 1);
AddDebugMessage("OnStart!", false);
}

void OnEnter()
{
AddDebugMessage("OnEnter!", false);
}

void OnLeave()
{
AddDebugMessage("OnLeave!", false);
}

void TurnOffLight(string &in asParent, string &in asChild, int alState)
{
SetLampLit("Name_of_your_lamp", false, false);
}
----------
I have not checked if this works, if it does not, make a comment Rolleyes
(This post was last modified: 03-29-2012, 08:53 PM by Mackiiboy.)
03-29-2012, 08:44 PM
Website Find Reply
reper1210 Offline
Junior Member

Posts: 18
Threads: 7
Joined: Mar 2012
Reputation: 0
#3
RE: Basic Light change wont work... please help

I have no idea why it should have worked but it did. how are you supposed to know exactly what to use in every thing you need to script? its not like the tutorial i used that tried to fade the lights gave me all that extra stuff you just gave me. for example what does the &in part do?

thanks for all the help so far, and unless you learned on this website can you send me a tutorial or website where you learned? noob to pro was good but confusing and doesn't have what i'd like to make.
03-29-2012, 09:47 PM
Find Reply
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#4
RE: Basic Light change wont work... please help

(03-29-2012, 09:47 PM)reper1210 Wrote: I have no idea why it should have worked but it did. how are you supposed to know exactly what to use in every thing you need to script? its not like the tutorial i used that tried to fade the lights gave me all that extra stuff you just gave me. for example what does the &in part do?

thanks for all the help so far, and unless you learned on this website can you send me a tutorial or website where you learned? noob to pro was good but confusing and doesn't have what i'd like to make.
.
The Engine Scripts and the Frictional Games Wiki script tutorials are great websites where you can learn almost everything you need to know. Examine and study other custom stories script-files or the original game script-files, it's great and ya'll learn mucho.
03-29-2012, 10:25 PM
Website Find Reply




Users browsing this thread: 1 Guest(s)