Frictional Games Forum
help script stuff sorta - Printable Version

+- Frictional Games Forum (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: help script stuff sorta (/thread-24186.html)

Pages: 1 2


help script stuff sorta - MrJackrabbit - 12-22-2013

heyllo,
so i just started scripting today so im new to everything. so i have a few questions.

1. what is a string&? example from engine scripts: int GetSwingDoorState(string& asName). that term is in every code and i don't know what it is.

2. how do i add text to a locked swing door? i have the stuff written out in the extra_english.lang but how do i apply it to the game? and also, how to i equip an object to a swing door so that whe the object is used on it the door becomes unlocked?

thank yall Big Grin

also, what is a floating object? or what does "float object" do? example: float RandFloat(float afMin, float afMax);


RE: help script stuff sorta - Kullin - 12-22-2013

1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors

Hope I helped you! Smile


RE: help script stuff sorta - MrJackrabbit - 12-23-2013

(12-22-2013, 11:30 PM)Kullin Wrote: 1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors

Hope I helped you! Smile

thank you very much! Big Grin
scripting is confusing


RE: help script stuff sorta - Kullin - 12-23-2013

(12-23-2013, 12:01 AM)MrJackrabbit Wrote:
(12-22-2013, 11:30 PM)Kullin Wrote: 1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors

Hope I helped you! Smile

thank you very much! Big Grin
scripting is confusing
No problem!

Yes it is but you will learn, trust me! Smile


RE: help script stuff sorta - MrJackrabbit - 12-23-2013

(12-23-2013, 12:11 AM)Kullin Wrote:
(12-23-2013, 12:01 AM)MrJackrabbit Wrote:
(12-22-2013, 11:30 PM)Kullin Wrote: 1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors

Hope I helped you! Smile

thank you very much! Big Grin
scripting is confusing
No problem!

Yes it is but you will learn, trust me! Smile
alrightt. so i tried it and it didnt work. what am i doing wrong? the level editor stuff, the extra_english.lang and map.hps and the error i recieved are below.

(12-23-2013, 12:21 AM)MrJackrabbit Wrote:
(12-23-2013, 12:11 AM)Kullin Wrote:
(12-23-2013, 12:01 AM)MrJackrabbit Wrote:
(12-22-2013, 11:30 PM)Kullin Wrote: 1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors

Hope I helped you! Smile

thank you very much! Big Grin
scripting is confusing
No problem!

Yes it is but you will learn, trust me! Smile
alrightt. so i tried it and it didnt work. what am i doing wrong? the level editor stuff, the extra_english.lang and map.hps and the error i recieved are below.
heres the other level editor one


RE: help script stuff sorta - Kullin - 12-23-2013

Can you post the whole hps file and the whole lang file here?


RE: help script stuff sorta - MrJackrabbit - 12-23-2013

<LANGUAGE>
<RESOURCES>
</RESOURCES>

<CATEGORY Name="CustomStoryMain">
<Entry Name="Description"></Entry>

</CATEGORY>

<CATEGORY Name="DoorLocked">
<Entry Name ="doorlocked1">An old and rusty lock has prevented this door from opening</Entry>
</CATEGORY>

</LANGUAGE>










void OnStart()
(

)

void OnEnter()
(

)

void On Leave()
(

)

void DoorLockedPlayer("DoorLockedPlayer")


{
if(GetSwingDoorLocked("mansion_1") == true)
{

SetMessage("DoorLocked", "doorlocked1", 0);

}
}







im not very far through...


RE: help script stuff sorta - PutraenusAlivius - 12-23-2013

Spoiler below!

void OnStart()
{
}

void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("mansion_1") == true)
{
SetMessage("DoorLocked", "doorlocked1", 0);
}
}


Your lang file is good. Above this text but in the same post is the script. You did put the PlayerInteractCallback function in the door properties in the Level Editor right?

EDIT: It only takes one error in the lang file for the whole lang file to get broken. If the lang file is broken, NO error messages WILL APPEAR. You can't see your description IF you had one.


RE: help script stuff sorta - MrJackrabbit - 12-23-2013

(12-23-2013, 01:28 AM)JustAnotherPlayer Wrote:
Spoiler below!

void OnStart()
{
}

void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("mansion_1") == true)
{
SetMessage("DoorLocked", "doorlocked1", 0);
}
}


Your lang file is good. Above this text but in the same post is the script. You did put the PlayerInteractCallback function in the door properties in the Level Editor right?

EDIT: It only takes one error in the lang file for the whole lang file to get broken. If the lang file is broken, NO error messages WILL APPEAR. You can't see your description IF you had one.

yea i did thatt. ohhh i think i put the void DoorLocked thing in the wrong place. ill omve that to OnStart and see if it works.

(12-23-2013, 01:31 AM)MrJackrabbit Wrote:
(12-23-2013, 01:28 AM)JustAnotherPlayer Wrote:
Spoiler below!

void OnStart()
{
}

void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked("mansion_1") == true)
{
SetMessage("DoorLocked", "doorlocked1", 0);
}
}


Your lang file is good. Above this text but in the same post is the script. You did put the PlayerInteractCallback function in the door properties in the Level Editor right?

EDIT: It only takes one error in the lang file for the whole lang file to get broken. If the lang file is broken, NO error messages WILL APPEAR. You can't see your description IF you had one.

yea i did thatt. ohhh i think i put the void DoorLocked thing in the wrong place. ill omve that to OnStart and see if it works.
welllll it didn't work


RE: help script stuff sorta - Romulator - 12-23-2013

BEFORE trying the scripting suggestion below in the spoiler...

Your script has opening brackets instead of braces in the OnStart(), OnEnter() and OnLeave() routines. Anytime you make events occur within a routine, you'll need braces, and not brackets. Try this Smile
PHP Code:
void OnStart()
{

}

void OnEnter()
{

}

void OnLeave()
{



Edit: OnLeave() is one word Smile

Spoiler below!
If you find this a nuisance, you could try purely scripting it...

PHP Code:
OnStart()
{
SetEntityPlayerInteractCallback("""DoorLockedPlayer"true);
}

void DoorLockedPlayer("mansion_1")
{
if(
GetSwingDoorLocked("mansion_1") == true)
{
SetMessage("DoorLocked""doorlocked1"0);
}