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
help script stuff sorta
MrJackrabbit Offline
Junior Member

Posts: 26
Threads: 10
Joined: Nov 2013
Reputation: 0
#1
help script stuff sorta

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);
(This post was last modified: 12-22-2013, 09:20 PM by MrJackrabbit.)
12-22-2013, 09:19 PM
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#2
RE: help script stuff sorta

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
Find
MrJackrabbit Offline
Junior Member

Posts: 26
Threads: 10
Joined: Nov 2013
Reputation: 0
#3
RE: help script stuff sorta

(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
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#4
RE: help script stuff sorta

(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
Find
MrJackrabbit Offline
Junior Member

Posts: 26
Threads: 10
Joined: Nov 2013
Reputation: 0
#5
RE: help script stuff sorta

(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


Attached Files
.png   Untitled2.png (Size: 351.01 KB / Downloads: 102)
.png   Untitled.png (Size: 7.24 KB / Downloads: 93)
.png   Untitled02.png (Size: 5.65 KB / Downloads: 93)
.png   Untitled1.png (Size: 470.76 KB / Downloads: 95)
.png   Untitled01.png (Size: 311.99 KB / Downloads: 96)
(This post was last modified: 12-23-2013, 12:30 AM by MrJackrabbit.)
12-23-2013, 12:21 AM
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#6
RE: help script stuff sorta

Can you post the whole hps file and the whole lang file here?
12-23-2013, 12:49 AM
Find
MrJackrabbit Offline
Junior Member

Posts: 26
Threads: 10
Joined: Nov 2013
Reputation: 0
#7
RE: help script stuff sorta

<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...
12-23-2013, 01:21 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: help script stuff sorta

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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 12-23-2013, 01:30 AM by PutraenusAlivius.)
12-23-2013, 01:28 AM
Find
MrJackrabbit Offline
Junior Member

Posts: 26
Threads: 10
Joined: Nov 2013
Reputation: 0
#9
RE: help script stuff sorta

(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
(This post was last modified: 12-23-2013, 01:37 AM by MrJackrabbit.)
12-23-2013, 01:31 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#10
RE: help script stuff sorta

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: (Select All)
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: (Select All)
OnStart()
{
SetEntityPlayerInteractCallback("""DoorLockedPlayer"true);
}

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



Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 12-23-2013, 02:01 AM by Romulator.)
12-23-2013, 01:57 AM
Find




Users browsing this thread: 1 Guest(s)