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 / Display a clickable HUD Button on Level Start.

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 23rd Oct 2013 08:27 Edited at: 23rd Oct 2013 08:29
I need a button to pop up when the level starts.

This is the code which I place into the MAIN script of an invisible dynamic entity, hidden in my level.



Level starts and nothing happens. I do not seek to use Mods to avoid complications since it IS in fact an included feature in FPSC, I am using only Core FPSC Syntax list.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 23rd Oct 2013 11:51 Edited at: 23rd Oct 2013 12:09
You need to go to a state= to show the hud, probably go to another state after to unshow it after performing its function..since I have no idea what its doing I have left out the actions but for a simple example:



I cant offhand remember what conditions you might require, perhaps hudselectionmade=, to use a mouse click for your button or if a simple keypress will do for you but this will give you a start.
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 23rd Oct 2013 17:18
The files "setuplevel.fpi" and "titlepage.fpi" (located in the Files\languagebank\english\gamebank\FOLDER) are good examples to refer to for setting up a button to click. These two core files use images as buttons and will work the same way in a level script. The command that you will need is the "hudselectionmade=x" command, which you are already using.

Also, as Rolfy pointed out, it is better to have the script go to a state other than zero to display a hud. If it remains at state zero, the hud would actually show before you enter the level. The same is said with post effects used. You need to allow for a five second delay from the time the level is loaded and you enter to the time you appear in the game.


There's no problem that can't be solved without applying a little scripting.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 23rd Oct 2013 21:48
Currently attempting to make a delay before prompting an HUD. I am on Latest Licensed FPSC Build BTW

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 23rd Oct 2013 22:45
- SOLVED -

and I am an Idiot...

My mistake was that I made custom script BUT, out of habit of organizing Each New projects files in new Project folders. I decided to put All my assets and everything in "Entities" folder of FPSC (zus Entities sort of hint to the word "assets") But guess what, FPS Creator Does not recognize an FPI file Unless it is stored within the
scriptbank" folder.


That is My mistake.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 23rd Oct 2013 23:45 Edited at: 23rd Oct 2013 23:46
Quote: "FPS Creator Does not recognize an FPI file Unless it is stored within the
scriptbank" folder"


Correct. That goes for any version.


There's no problem that can't be solved without applying a little scripting.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 24th Oct 2013 05:55 Edited at: 24th Oct 2013 05:57
Ok now last thing before I can figure the rest out by myself,

when I use - hudshow=pointer, I need to detach the mouse from camera control and attach it to the pointer. Can't seem to find a permanent control block in Syntax List.

Currently when I prompt hudshow=pointer, it sticks in the middle of the screen and the mouse moves the camera view.

This thread was the only one I found that had a cursor function but it was commented to be the, although working, but improper way to get the mouse to control the pointer.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 24th Oct 2013 09:47 Edited at: 24th Oct 2013 09:53
Never tried what your doing so don't know if a pointer can be defined in a script other than the setuplevel.fpi. You could still define the hud in setuplevel and show, unshow from a script in game. But going by that thread it doesn't look like there is a command to disable mouse look, at least when that thread was started. It may be introduced in one of recent updates but not that I can recall. Check the syntax list.

Pretty sure Blackfox has an inventory system that uses what your after so maybe he can put you in the right direction, might not though since he worked it out for his game and he can be pretty covetous of the shiny toys
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 26th Oct 2013 16:39 Edited at: 26th Oct 2013 16:46
Quote: "Never tried what your doing so don't know if a pointer can be defined in a script other than the setuplevel.fpi. You could still define the hud in setuplevel and show, unshow from a script in game.

Pretty sure Blackfox has an inventory system that uses what your after so maybe he can put you in the right direction,"


I can tell you that I am using the pointer as defined in the "setuplevel.fpi". Since the pointer is defined and the items in the "setuplevel.fpi are called and running already, I have the "setuplevel.fpi" calling the inventory script when the key is pressed. One thing I do is use the "pausegame" command which allows me to have the mouse pointer under my control and not affect the player. Once done, I use the "resumegame" command.

One thing you cannot do is have one script define a hud/image and another script show/unshow it. The script that defines the image(s) is the only script that has control of it.

Here is a sample WIP where we started the work on this to demonstrate that the mouse can be used to access inventory and the player is not affected. I also can use this in any version of FPSC since I am using the standard commands (no mods).




There's no problem that can't be solved without applying a little scripting.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 26th Oct 2013 17:00
So i assume pause snd resume game functions are added via the mod?

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 26th Oct 2013 17:16 Edited at: 26th Oct 2013 19:05
Quote: "So i assume pause snd resume game functions are added via the mod?"


No. The commands have always been in standard FPSC.

While I use my own re-written source, all of our scripts use default commands. I only have a few commands added to what was existing already in my version (such as mouseclick/mousestate and a few others form v1.18-1.20). The above WIP example I showed uses nothing but default commands which will run in v1.17 right through to v1.20.


There's no problem that can't be solved without applying a little scripting.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 26th Oct 2013 18:26 Edited at: 26th Oct 2013 18:45
I get the script flow here, so "pausegame" function transfers the controls of the mouse from Camera to Pointer and "SelectionMade" function automatically reads which button HUD the pointer clicked on.

Heh, I've been looking for this damn Pause Function in Syntax List... don't know why I couldn't find it.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 26th Oct 2013 19:05
Quote: "Heh, I've been looking for this damn Pause Function in Syntax List... don't know why I couldn't find it."


Taken from Script Syntax list v5.1, 13 Dec 2012...

3.17.2.9 PAUSEGAME
Description: This pauses the game and displays the in-game menu.
Example: :state=1:pausegame

3.17.2.15 RESUMEGAME
Description: This resumes the game and closes the in-game menu.
Example: :state=1:resumegame


You may have missed it or perhaps looked for "pause game" instead of "pausegame".


There's no problem that can't be solved without applying a little scripting.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 26th Oct 2013 19:37
Yeah I forget that PDF Search is wonky so unless I know exactly what I'm looking for, I have to cycle through keywords in every match.

Oh well

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com
Old Larry
11
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 29th Oct 2013 22:24
Nice work Tobias_Ripper
I'm trying to find a script to use in the "titlepage.fpi".
So, when the player presses the "New Game" button, near this button it appears the "Option" button.
I have done this and it works fine. BUT I need a script that when the player presses "Options", this button to open an executable file (like "Game Settings.exe"), for graphics options.
Thank you so much !

Smile today, tomorrow could be worse
http://bestradiolarry/fpsarea
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 29th Oct 2013 23:52
No credit for me here... I just asked the questions.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: Milesthatch.com

Login to post a reply

Server time is: 2024-04-19 06:05:21
Your offset time is: 2024-04-19 06:05:21