Frictional Games Forum

Full Version: help script stuff sorta
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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);
1. The string& mean that the name has to be in ""

Like: GetSwingDoorState("Door1")


2. Go here ----> http://wiki.frictionalgames.com/hpl2/tut...cked_doors

Hope I helped you! Smile
(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/tut...cked_doors

Hope I helped you! Smile

thank you very much! Big Grin
scripting is confusing
(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/tut...cked_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
(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/tut...cked_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/tut...cked_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
Can you post the whole hps file and the whole lang file here?
<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...
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.
(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
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);
}


Pages: 1 2