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 AddUseItemCallback and PlayerInteractCallback not working
craazyy1 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Mar 2012
Reputation: 0
#1
AddUseItemCallback and PlayerInteractCallback not working

When trying to load the map, it says this:
(21, 1) INFO: Compiling void KillStephano
(23, 37) ERR: 'StephanoDeath' is not declared

As you can see, (23, 37) StephanoDeath has been declared by a " on either side. I have tried with ' instead, same error.

Pastie to the script:http://pastie.org/3997016

Ignore the "// <>"and "// "s, They're there to let notepad++ group them correctly. The two slashes make the parsing skip them anyway.

Sorry if I sound stupid, I'm a little new.

Chocobos are awesome! KWEH!! ^-^
Sorry for stupid questions, I'm kind of new to scripting
(This post was last modified: 05-30-2012, 10:21 PM by craazyy1.)
05-30-2012, 08:05 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
RE: Declared thing is not declared

The function KillStephano() isn't declared.
You're missing the syntax, which by default is string &in asItem, string &in asEntity

05-30-2012, 08:42 PM
Find
craazyy1 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Mar 2012
Reputation: 0
#3
RE: Declared thing is not declared

(05-30-2012, 08:42 PM)Obliviator27 Wrote: The function KillStephano() isn't declared.
You're missing the syntax, which by default is string &in asItem, string &in asEntity
I added the syntax in the parenthesis in KillStephano(), so it's now 'void KillStephano(string &in asItem, string &in asEntity)' but i get the same error.
One thing, what is the point in typing the syntax, half the time i don't even need it

Chocobos are awesome! KWEH!! ^-^
Sorry for stupid questions, I'm kind of new to scripting
05-30-2012, 08:57 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: Declared thing is not declared

StephanoDeath.ogg needs quotes around it because it is a string. (Also you usually only use .snt files for PlaySoundAtEntity, but I think I've seen someone use .ogg successfully before. If the sound doesn't play, it's safe to switch to an .snt file)

(This post was last modified: 05-30-2012, 09:01 PM by Damascus.)
05-30-2012, 08:59 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#5
RE: Declared thing is not declared


void OnStart()
{
AddUseItemCallback("", "key_door_1", "door1", "OpenDoor", true);
AddUseItemCallback("", "key_door_1", "door1", "KillStephano", true);
}
void OnEnter()
{

}
void OnLeave()
{

}
void OpenDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(item);
}

void KillStephano(string &in asItem, string &in asEntity)

{
PlaySoundAtEntity("StephanoDeath", "StephanoDeath.snt", "barrel01_1");
}

void BarrelExcuse ()
{

}

I have made some additions to your script, if you want to open a door now. Just use this one at onStart:
AddUseItemCallback("", "KEYNAMEHERE", "DOORNAMEHERE", "OpenDoor", true);



Just put the keyname at KEYNAMEHERE and doorname at DOORNAMEHERE to open the door with any key Smile.



ALSO.
It needs to be .snt, if you want to know how to make custom sounds. Check this:
http://wiki.frictionalgames.com/hpl2/tut...cript/page


Signature to awesome to be displayed.
05-30-2012, 09:07 PM
Find
craazyy1 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Mar 2012
Reputation: 0
#6
RE: Declared thing is not declared

1. Fixed the first issue, was as Damascus said.
2. Got an issue with it complaining about lack of float and bool, but complaining about them being there when i added them, was because i wrote 1s(econd) instead of just one... *facepalm*
3. Thanks for reminding me about the OpenDoor on everything idea. Had completely forgot that.
4. Going to change to .snt now, I remember now that .ogg was for journals.

Ok, Sound isn't playing. Most likely since it didn't get executed for some reason, as none of the things in BarrelExcuse are working.

http://pastie.org/3997636

Chocobos are awesome! KWEH!! ^-^
Sorry for stupid questions, I'm kind of new to scripting
05-30-2012, 09:54 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#7
RE: Declared thing is not declared

BarrelExcuse.snp
you wrote .snp, instead of .snt. And in the one before that too, you wrote .snp.
(P.S. Final Fantasy ftw)
EDIT
woah your script is very strange looking.. you've written that using a key will open a door and trigger events, and you wrote it again so the same key opens the same door but triggers different events. Two adduseitemcallback's are not needed. Plus there are these weird <>//'s everywhere, which are not needed as well.
Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_door_1", "door1", "OpenDoor", true);
}

void OpenDoor(string &in item, string &in door)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
PlaySoundAtEntity("Stephanos death", "StephanoDeath.snt", "arabic_statue_gold_1", 1, false);
SetPlayerActive(false);
PlaySoundAtEntity("Barrels excuse", "BarrelExcuse.snt", "barrel01_1", 1, false);
SetPlayerActive(true);
};

void OnEnter()
{
}

void OnLeave()
{
}


I don't know where the barrel's excuse stuff is supposed to go, because it was not declared to happen in the original script. Tell me what that does for you.

Ba-da bing, ba-da boom.
(This post was last modified: 05-30-2012, 10:04 PM by JenniferOrange.)
05-30-2012, 09:57 PM
Find
craazyy1 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Mar 2012
Reputation: 0
#8
RE: Declared thing is not declared

Major derpingtons :S
Had even saved the files as .snp
Apparently .snp is a sound format too... Tongue
They're still not executing though, anyone see why? or do i have to send the map file and everything? How do you get something to execute when you interact with it (Pick up a barrel in this case) (just incase i did it wrong, though the one with the key on the door should still work)

Meh, I'll skip that while waiting, and come back to it later.

Ok, nothing wants to work today, apparently.

Spoiler below!
void DoorFalls() //<>
{
SetEntityActive("servant_brute_1", true);
SetEnemyDisableTriggers("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 1, "idle");
} //


This part won't execute either.
I've tried:
Spoiler below!

(in OnStart)AddTimer("DoorFallsTimer", 60, "DoorFalls")

(In OnStart)AddUseItemCallback("", "key_door_1", "door1", "DoorFallsTimer", true);

(Global)DoorFallsTimer()
{
AddTimer("DoorFallsTimer", 30, DoorFalls)
}

And even writing DoorFalls in the PlayerInteractCallback on the door it appears behind.

The only way to get it to work is to run it directly from OnStart off the bat, which is not what i want

Chocobos are awesome! KWEH!! ^-^
Sorry for stupid questions, I'm kind of new to scripting
(This post was last modified: 05-30-2012, 11:19 PM by craazyy1.)
05-30-2012, 10:00 PM
Find
craazyy1 Offline
Junior Member

Posts: 9
Threads: 2
Joined: Mar 2012
Reputation: 0
#9
RE: AddUseItemCallback and PlayerInteractCallback not working

Oh, thanks!
The //<> are for neatness, as it doesn't automatically group them. // means it doesn't get parsed, and everything between <> and </'>is grouped.

The BarrelsExcuse thing is just to make the character unable to move while a sound clip plays, as you pick up the barrel. The barrel in the map has 'BarrelExcuse' in the 'PlayerInteractCallback' thing to run this when you pick him up (Though i might have done it wrong)

BarrelsExcuse, StephanosDeath and DoorFalls still don't work

This is what it looks like now:
Spoiler below!

void OnStart() //<>
{
AddUseItemCallback("", "key_door_1", "door1", "OpenDoor", true);
} //</>
void OpenDoor(string &in item, string &in door) //<>
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
PlaySoundAtEntity("Stephanos death", "StephanoDeath.snt", "arabic_statue_gold_1", 1, false);
AddTimer ("DoorFallsTimer", 15, "DoorFalls");
}; //</>
void OnEnter() //<>
{

} //</>
void OnLeave() //<>
{

} //</>
void BarrelExcuse (string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound) //<> Not Working
{
SetPlayerActive(false);
PlaySoundAtEntity("Barrels excuse", "BarrelExcuse.snt", "barrel01_1", 1, false);
SetPlayerActive(true);
} //</>
void DoorFalls() //<>
{
SetEntityActive("servant_brute_1", true);
SetEnemyDisableTriggers("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 1, "idle");
} //</>


Oh, and the reason i have the //<> things


Attached Files
.png   Why i have the weird things.png (Size: 7.8 KB / Downloads: 105)

Chocobos are awesome! KWEH!! ^-^
Sorry for stupid questions, I'm kind of new to scripting
(This post was last modified: 05-31-2012, 12:13 AM by craazyy1.)
05-30-2012, 11:36 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#10
RE: AddUseItemCallback and PlayerInteractCallback not working

You forget the strings everytime, also, the function is not used. So before you do that, make sure that it is used. And
void KillStephano(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound) //<>

Should be:
void KillStepahno(string &in asItem, string &in asEntity)



I have no idea what the BarrelExcuse is, but it is NOT used.
And Doorfall, is also not declared. Please fix that.


Maybe this helps you editing more:
http://www.frictionalgames.com/forum/thr...#pid139289 (check 4.)

Signature to awesome to be displayed.
(This post was last modified: 05-31-2012, 01:45 PM by Stepper321.)
05-31-2012, 01:17 PM
Find




Users browsing this thread: 1 Guest(s)