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 / Keycoded door (remote door)

Author
Message
CosmicPhantom
5
Years of Service
User Offline
Joined: 7th Sep 2014
Location:
Posted: 16th Nov 2014 00:35
Hi all this is my first time posting here

I'm trying to make a key coded door that uses a pin to unlock e.g. 1234 opens the door anything else won't the script I'm using is from the user Storytellers

but it wont work for me I'm using FPS Creator original patched to version 1.19 and putting the code in the (main) entry for a keypad but when I go to use it nothing appears please can some one tell me what I'm doing wrong as I have been trying to get this working for over 5 hours and still got nothing. I have set the (if used) section of the keypad to my door's name as well.

Thanks all

C-P
ncmako
7
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 16th Nov 2014 14:03
HI CosmicPhantom
I remember this script, it should work fine as long as you
didn't change anything. It's in the "Main AI" for the key pad.
But when you say
Quote: "when I go to use it nothing appears"

what do you mean? The key pad itself isn't there or the script
doesn't run?
I assume you mean the "script" doesn't run, first double check
that the "key pad" is dynamic. Also be sure to be within 60 units
to trigger the script.
best

My games never have bugs. They just develop random features..
Sinister Spoon
11
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 23rd Nov 2014 20:49
im sure the script supplied is as efficient as it possibly could be but it seems awfully complex for the effect its hoping to achieve...

I havent used fpsc forums for a while so I may be out of line with this but couldnt a simpler effect be achieved? it seems based on sending the state to a specific line should a specific key be pressed meaning for every 10 digits there are 9 repeated lines of code and only one line that directs the engine to the next logical progression path

wouldnt it make more sense to allow the player to input simply 4 values then using variables check to see if those values correspond to the stored values in the script?

say for example everything is sent to state=2

so :state=2,scandcodepressed=1(not using correct syntax here just trying to explain, where 1 represents the numeric key press of 1)so it displays a 1 digit on screen:hudreset(etc display image 1 in first digit field and use localvar=1,incvar=1) to tell fpsc the 1 key has been pressed,

then all the other checks are done in state=2in the same way evertime a key is pressed it adds 1 to the variable corresponding to that digit,eg scancodekeypressed=2(where 2 is the numeric key again not sure what the scan code for it is), inc local var 2 by one,

state=2,scankeypresed =3, inc var 3 by one, and so on and so forth

then after the var has been incremented 4 times run a check comparing the local var values against the stored values for the code,so say you have an additional variable that is incremented everytime a key is pressed regardless of which key it is, when this variable hits 4 it triggers the state which compares the variables of the code you entered to the code required and if they match it then grants access opening the door

for example

if code is 7231, check var 7,2,3,and 1 are set to values of 1, if correct go to state=20 or whatever(again not correct syntax) if incorrect, reset all huds and return to state 0?

I use a very similar method to keep track of and display items the character has picked up (up to 28 and counting so far) and each item inc's a var related to it and the inventory script checks each items var value one by one and displays its image in the correct location if that var is met. if the variable isnt met, meaning the player hasnt picked up the item, it doesnt display the image and skips to the next item check.

personally i use globalvar's for reasons that will become apparent if anyone with a working knowledge of fpsc were to play the game im currently working on but for a simple keypad local var's would seem to be the way to go as they are specific to the entity script within which they are contained. as far as i know :0

I know this probably isnt neccesarily the answer to the problem but im kind of a efficiency nut and i just saw the script and wanted to make it smaller I didnt sit down and write the script because who knows wether anyone will even read this but if people are unsure of what i mean I'll be happy to whack out a quick example script to show you what i mean.

Happy gaming

smoke em if you got em
Sinister Spoon
11
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 23rd Nov 2014 20:53
also (apologies about the double post apparently its classing me as a new user and my posts need to be authorised) I noticed in state=3 you were doing an etimer condition check but there doesnt seem to be an etimerstart action listed in any of the lines prior to it, this seems the most likely place the script is going wrong, as it will halt there waiting for the timer to hit 500, but since the timer never started, this condition will NEVER be met, effectively breaking the script completely... or am i missing something?

smoke em if you got em
The Storyteller 01
10
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 26th Nov 2014 14:59 Edited at: 26th Nov 2014 17:21
@Blackphantom:

The link from my orginal post on this forum doesn't work any longer but I have reposted this script in my blog and made a new upload for the whole pack: http://thestoryteller01.wordpress.com/category/fps-creator/

The download includes a mini level using the script (complete with the alarm sound) and maybe it would help to take a closer look at the setup in my level to find out what's not working for you.


@SinisterSpoon:

If you can pull off a shorter and editing-friendlier variation of my script - please go ahead! If it works, I would gladly post it in my blog with full credits to you.

In case you find my grammar and spelling weird ---> native German speaker ^^
Sinister Spoon
11
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 27th Nov 2014 17:00
@the storyteller 01

i dont think the issue is with the script, well it is and it isnt the script as posted 'not working' had this issue


see in bold its waiting for a time condition but the timers never activated prior to that point, thats where the script is breaking, its waiting for the timer to hit 500 but the timers at 0 at this point in the script, so the script is waiting for a condition that at its current state can never be true...

anyway


as promised heres the shorter version, (i hope i didnt sound arrogant or rude, i just have a thing for efficiency and variables at the moment )

basically it works like this, the player interacts with the keypad, the keypad then checks to see if a digit has been entered,
if no digit has been entered it waits for one, once a digit has been entered it repeats the process till it has 4 digits entered,
setting the localvar 1-4 to their corresponding numeric, eg
if key 9 is pressed for the 1st code digit it sets localvar=1 to a value of 9

then once all localvar's are set, it checks them against their stored values, and opens the door or whatever if they all match,
if any of the digits entered are incorrect, it plays an alarm and
resets the script to state=0 to allow the player to try again

a lot of it is placeholder text since i dont really know how to use the fpgcraw text yet (only updated from 1.13 to 1.20 a couple days ago so im still using dds images as text ) so just bare that in mind, this is just the AI to control the
actual code, it wont display anything, Ive added a 5th variable (localvar=5) to track which digit is being entered should anyone still be using the older dds style hud for displaying txt to tell the game which 'batch' of numeric image files to use (ie, the numbers 1-9 set up as huds, with an x offset to account for the change of digit offset by 10 for second digit, 20 for 3rd, 30 for 4th etch for positioning and display purposes)



the timers are there to make sure the key press is registered once
as fpsc doesnt seemt o like multiple key press conditions coded immediatley after each other without a pause to allow the player to pull their finger off the key.

As you can probably tell i havent done any testing or set up any huds its just a proof of concept, it dont really need a keycode atm i just thought maybe there might be a more efficient method, although with all the notations i added mines probably twice as long as the original

hope this is in someway useful, im not sure that its better than the original script, i just like confining any numerical options to a variable since variables can be read by multiple different actions and even by other scripts were you to use global ones



smoke em if you got em
The Storyteller 01
10
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 28th Nov 2014 09:57
The first ETIMERGREATER is indeed missing an ETIMERSTART but it doesn't break the script.

I tested it and it works fine. Since there is no ETIMER running at this point, the engine simply ignores the condition. The script still is faulty, because the 500 unit break is not implemented, so i'll change this.

Thanks for looking it up.

I had no time for testing your script though but I will over the weekend

In case you find my grammar and spelling weird ---> native German speaker ^^

Login to post a reply

Server time is: 2019-09-19 02:03:43
Your offset time is: 2019-09-19 02:03:43