Frictional Games Forum (read-only)

Full Version: Need Help for Scripting Rotating Bookshelf
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im trying to script my custom map so that when you pull a lever it rotates a bookshelf so the player can advance, but it isnt working.
Here is my code:
PHP Code:
    SetEntityConnectionStateChangeCallback("lever_book""shelf");
void shelf(string &in asEntityint alState){     if (alState == 1)     {     SetMoveObjectState("books",1.0f);     PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);          return;     }} 

books is the name of the bookshelf, and lever_book is the name of the lever. Any ideas?

sorry the code looks really bad, this is my first post on this forum,
Can you please specify what isn't working? Does it not have the desired effect in game, or is it crashing and giving you a message of what is causing it?
(08-28-2012, 03:12 AM)zTizzle Wrote: [ -> ]Im trying to script my custom map so that when you pull a lever it rotates a bookshelf so the player can advance, but it isnt working.
Here is my code:
Spoiler below!
PHP Code:
    SetEntityConnectionStateChangeCallback("lever_book""shelf");
void shelf(string &in asEntityint alState){     if (alState == 1)     {     SetMoveObjectState("books",1.0f);     PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);          return;     }} 

books is the name of the bookshelf, and lever_book is the name of the lever. Any ideas?

sorry the code looks really bad, this is my first post on this forum,
first, congratulations, i have no idea how, but you managed to confuse my android browser completely with this script. i'm not sure, if i'm the only one with this problem, but maybe you cut put the code into a spoiler, so this thread isn't messed up the whole time.
(you can do spoiler with [spoi ler] your text [/spoi ler] (obviously without the spaces^^)

but ok, first, i would recommend to make use of the lovely enter-key, makes it easier to work with, and sometimes, for example in python, you have to do it. if it's just because of the mixed up forum-post, then... this doens't matter, excuse me.

and could you tell us, what specifically is wrong? what happens in the cs, does the switch simply not work? crashing?


edit: and andy was faster, as always. sorry for the doubled question.
Here's how your script should look:


void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_book", "shelf");
}


void shelf(string &in asEntity, int alState)
{
if(alState == 1)
{
SetMoveObjectState("books", 1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
}
}

And here's a quick tutorial for secret shelves (just follow the top portion labeled "The Bookshelf"):

http://wiki.frictionalgames.com/hpl2/tut...cretshelfs


Hope that helped.