Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / New To Scripting. Where Do I Start?

Author
Message
Fyfer08
15
Years of Service
User Offline
Joined: 29th Jun 2009
Location: Scotland
Posted: 29th Apr 2011 23:46
Hey..
I really want to learn how to script in FPSC but i dont know where to start any suggestions?

bobochobo
16
Years of Service
User Offline
Joined: 9th Jul 2008
Location: My house, in the middle of my street
Posted: 30th Apr 2011 00:09
Have you read the manual? That's probably the best thing to start with. You should download the latest FPI EditPad, it's very useful.
Use it to open up existing scripts and play around with them to geta feel for things.

Fyfer08
15
Years of Service
User Offline
Joined: 29th Jun 2009
Location: Scotland
Posted: 30th Apr 2011 00:16
I have got the edit pad but all this sate1:state10 things dont make sense

Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 30th Apr 2011 01:11 Edited at: 30th Apr 2011 01:12
Quote: "I have got the edit pad but all this sate1:state10 things dont make sense"

Really,if you say so, oh wise one...

If you can't understand this,how will you ever understand programming languages (not to mention low-level ones...)

In a script , on each row there's an ACTION and a CONDITION. The CONDITION comes BEFORE the ACTION.It is always wrapped around in colons ( : ).You can have multiple conditions on the same row,you just have to divide each condition with a comma ( , )

Same thing goes for the ACTIONS.You can write as many on one row as you like,you just have to divide them with commas(note:after the last condition or action,there shouldn't be a comma)

States are like pointers ,telling the engine to which part of the script to go.States can be both conditions and actions(self-explanatory why..).The initial state number for every script is 0 and you can set it to whatever you like.The whole script is in a constant loop,so if you don't change the state,the engine will repeat the line with the current state until you close the program(or move to another level).

For example - :state=0:if the current state of the script is equal to 0,then return true and perform actions here

Simple example of states -
Quote: "
:state=0,plrdistwithin=100:plraddhealth=-25,state=1
"

This piece of "code" translates into plain English like this :

*If the current state is equal to 0(zero) AND the player is within a distance of 100 units(1 segment in radius) , then substract 25 points from his health and change the current state to 1,so that the substraction is done only once.Once the state is equal to 1,nothing will be executed , because there are no conditions checking if the state is equal to 1 and no respective actions given,if true is returned on that condition.

Does this help ?


PC Specs:Windows 7 Ultimate 64-bit,Intel Core i7 960 @ 3.20GHz,NVIDIA GeForce GTX 480,12GB RAM,2x Western Digital 997GB HDD
Fyfer08
15
Years of Service
User Offline
Joined: 29th Jun 2009
Location: Scotland
Posted: 30th Apr 2011 10:53
Yea Thanks alot just getting the translation right..

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 1st May 2011 22:11
What is the command to activate an entity by pressing a key and not just being close to the object. Like with this door script:



Thanks.

God help me, Please.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 1st May 2011 22:33 Edited at: 1st May 2011 22:36
Replace "plrusingaction=1" with scancodekeypressed= " and insert the scancode for the key you want to use.

Brian.

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 1st May 2011 22:41 Edited at: 1st May 2011 22:52
Quote: "Replace "plrusingaction=1" with scancodekeypressed= ""


Sooo if I wanted the key to be I don't know 'q' or 'enter' what would I put? Thanks.

EDIT: So how does the usedoor script work with the 'enter' key? They used no scancodekeypressed command. I'm guessing that there is a different way? Can someone please explain this to me?

God help me, Please.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 1st May 2011 23:05
"plrusingaction=1" means that the player pressed the "Enter" or action key.
If you want to use another key, you use the "scancodekeypressed=" condition. The Community guide has the scan code values in it. I don't remember them off the top of my head.

Brian.

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 1st May 2011 23:28 Edited at: 1st May 2011 23:39
@xplosys
Thanks for all of your help! Could you just "grade" just one script for me.
Script:



Will this make it where I have to press enter to add health to my plr? Thanks.

EDIT:
I'm guessing that I will have to add a hud to that also right? But I know what hudimagefin and hudimage does but what are the differences?

EDIT: Hud added. Please check and respond. Thanks.

God help me, Please.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 2nd May 2011 00:06 Edited at: 2nd May 2011 00:07
Your state=0 line correctly prepares the HUD for use and progresses the script to the next line (state=10) however that line never calls the HUD so it will not be shown.

This is how it is in the script you posted a couple of posts above...

:state=10,plrdistwithin=60:hudshow=usedoorprompt,hudfadeout=usedoorprompt

You must call the HUD to be shown.

Your state=10 line will add 50 points to the players health if he presses the enter key and then the script will progress to line state=1. Of course that line does not exist so the script will end.

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 2nd May 2011 00:22
So I just add the call and fade command and it will be good to go? Thanks. Also what about the activate command. Isn't it just like the state command? Thanks.

God help me, Please.

Login to post a reply

Server time is: 2024-11-24 08:48:25
Your offset time is: 2024-11-24 08:48:25