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 / Very first script

Author
Message
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 31st Dec 2010 08:17

This is my very first script I made, it's just a Modification of a standard light. It makes it so if they player is within 3 segments of the light, they can press the enter button to turn it off, and then back on.
I haven't checked if it works yet, cause I'm away from my computer.
And tips or mistakes spotted? I want to start making scripts so I gotta start small to go big.

If you don't try, you fail.
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 31st Dec 2010 09:14
-----------EDIT------------
Sorry bout double post, iPod won't let me edit my posts..
Anyways, I looked more at the script and found a better way to revise it.

How does this one look? Better than the first?

If you don't try, you fail.
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 31st Dec 2010 16:30
It looks oh-so-wrong...

You don't end conditions,which results in the whole script to be wrong.

Half of it doesn't make any sense either.How do you plan on going to the state 2 line when you don't switch from state 1 to it.

Conditions are wrapped around with :conditions:
After the second : you write actions.

States are indicators what part of the script to be executed.

:state=0:state=1 translates into english to IF the current state is equal to 0 (zero) , then change the state to 1 (one) and go execute what's on State=1

Next row checks if the state is equal to 1 and does something and etc,etc,etc.


PC Specs:Windows 7 Ultimate 64-bit,Intel Core i7 960 @ 3.20GHz,NVIDIA GeForce GTX 480,12GB RAM,2x Western Digital 997GB HDD
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 31st Dec 2010 18:30
Quote: "Half of it doesn't make any sense either.How do you plan on going to the state 2 line when you don't switch from state 1 to it."
How about this script? Does it solve the fact my one above never got to state 2? And I put the lighton in state 1, is that what I should have done?
Also how do I and my conditions?

If you don't try, you fail.
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 31st Dec 2010 18:32
How do I end my conditions?***
sorry iPod won't let me edit posts.

If you don't try, you fail.
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 31st Dec 2010 22:13
You end the condition with a colon ( , however if you have multiple conditions you separate them with a coma (,) and after you write all of them you place the colon (

Ex. - :state=0,plrwithinzone=1,plrhealthgreater=1:state=1


PC Specs:Windows 7 Ultimate 64-bit,Intel Core i7 960 @ 3.20GHz,NVIDIA GeForce GTX 480,12GB RAM,2x Western Digital 997GB HDD
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 31st Dec 2010 22:35
ohk thanks
so something like this?


;Artificial Intelligence Script

;Header

desc = Light Toggle on/off by enter key(On By Default)

;Triggers

:state=0:state=1
:state=1,activated=1,lighton:state=2
:state=2,plrdistwithin=100:state=3
:state=2,plrdistfurther=100:state=1
:state=3,scancodekeypressed=28:state=4
:state=4,lightoff:state=5
:state=5,plrdistwithin=100,scancodekeypressed=28:state=2
:state=5,plrdistfurther=100:state=4

;End of Script


how what that do? thanks for helping me learn if you see im sill making mistakes could you hlp me further?

If you don't try, you fail.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 1st Jan 2011 02:09
Better, but you now need to know that "lighton" and "lightoff" are not conditions, they are actions.

Conditions check for something to be TRUE. Actions... well they DO something (such as turning the light on or off).


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Cross Hair Games
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Canada Eh\'
Posted: 1st Jan 2011 02:47
yea i ran it through FPI Edit pad
and it helped me understand stuff more, cause i knew what you were talking about wheen u said i did it wrong or w.e but i wanted to know how to not only fix it, but understand why it was wrong.
this is the final script and i ran it through fpi edit pad and it said everything was good on my newest update
here it is:


;Artificial Intelligence Script

;Header

desc = Light Toggle on/off by enter key(On By Default)

;Triggers

:state=0:state=1
:state=1,activated=1:lighton,state=2
:state=2,plrdistwithin=100:state=3
:state=2,plrdistfurther=100:state=1
:state=3,scancodekeypressed=28:state=4
:state=4:lightoff,state=5
:state=5,plrdistwithin=100,scancodekeypressed=28:state=2
:state=5,plrdistfurther=100:state=4

;End of Script

i just had to change were my ( : )'s and ( , )'s were to end conditions and start actions, and so forth.
im gonna fpsc test it when new years is over cause i have people coming over in 10 min.
Happy New Years Btw

If you don't try, you fail.

Login to post a reply

Server time is: 2024-11-24 15:10:08
Your offset time is: 2024-11-24 15:10:08