Scripts / Game Menu Scripting Issues

Author
Message
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 24th Oct 2019 03:36 Edited at: 24th Oct 2019 05:59
Hi all,

So spent the day creating Menus Screens for standalone build, and have a few questions\observations.

1)
For all scripts employed for the Loading screens and In-Game menus, every single variable is Global.
- my first question is why - is there a reason for it?
- I thought globals were bad practice unless required. Have I got this wrong....

2)
For the In-Game menus I wanted to have a shade behind the menu items.
To do that I added code to:
- GameMenu
- Graphics
- Sounds
- LoadGame
- SaveGame

Example in GameMenu


Now this works fine for all the In-Game Menus except LoadGame and SaveGame.
The shade does not show up.
What am I missing.......?

3)
The LoadGame screen in the Start Menu, and the LoadGame on the In-Game menu are using the same script.
This is counter productive to customizing the look of the game menus.
I think they should be separate items.

4)
Preparing core files....
Anyone know where we can edit this?

5)
On a side-note there are quite a few images that are not used as far as I can see...


EDIT: OOPS meant to be in scripting I guess - calling a mod

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Oct 2019 10:02
Quote: "Now this works fine for all the In-Game Menus except LoadGame and SaveGame.
The shade does not show up."

You've posted "Example in GameMenu", can you do the same with your load game/save game script?
At least the modified parts (if any)
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 24th Oct 2019 12:22 Edited at: 24th Oct 2019 12:25
@3com Thanks for input.

Yeah, I used the same code as the example above in each script. It works fine for all of them except LoadGame and SaveGame.

EG:




Scripts below
OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.

Attachments

Login to view attachments
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Oct 2019 13:04
I don't have time now to go deeper into the script, so I will ask / explain some things that you may already know, but other users may not.
I have noticed that you have changed many images, since I do not have them in my pc, the script will throw an "image missing" error, so I will not be able to test your code. When I have a free moment I will try my own images, that is no problem.

What does "style.txt" put in your file?

The "Default" folder contains the folders of each resolution, therefore the images must be stored in the corresponding resolution, for example: "1280x720" contains all the images of that resolution; therefore your image called "loadingmenu.png" should be in its corresponding folder. This is so?


About your "shade.png" image, I guess you want it behind of the loading image; it is not easies way to merge both images in one and you are done; if you are looking for some sort of relief effect?

If you want the shadow behind the image, I wonder if you don't have to work with: "SetSpriteDepth (yoursprite, 100)"
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 24th Oct 2019 13:23
Quote: "What does "style.txt" put in your file?"


The style.txt is a text file where you can specify which of the sets of menus you want to export to standalone.

So for example you copy the default folder and its contents, then rename that folder to MyGame and edit the contents, then if you open the style.txt and change default to MyGame, when the standalone is generated it will use the MyGame menus instead of the default ones.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Primary Laptop:
i5, NV1050 4GB, 8GB memory, 1x 1TB HDD, Win10.

Secondary Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 24th Oct 2019 14:14 Edited at: 24th Oct 2019 14:56
Thanks 3com - yeah, like Belidos said with regard to style.txt.

Quote: "About your "shade.png" image, I guess you want it behind of the loading image; it is not easies way to merge both images in one and you are done; if you are looking for some sort of relief effect?"


The shade is for In-Game menus see my Naelurec wip for example

You can put the code in my example into the stock scrips, and just put any image named shade.png in with all the buttons to test it.
The code works for all In-Game screens except SaveGame and LoadGame.

LoadGame is used for both Main Menu and the In-Game menu. Which is weird because the in-game LoadGame does not show the backdrop image. Likewise with SaveGame, I don't quite get why the default script has backdrop code in it, as it is only used in-game, and the backdrop does not get used there either.

Maybe I be blind but I can't see any flag that toggles the backdrops on\off...

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 24th Oct 2019 16:25
Moved to scripts section at OP's request.
RIP
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

New:
Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 12GB RAM, Nvidia gtx1050ti 4gb, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Oct 2019 17:58
@ OldFlak
You are right when you said : More tinkering required I guess.
As I said above working with July update version, now I've updated to latest build : 2019-10-04.
After update I've tried firts the official loadgame.lua file and I'm getting the text behing the backdrop, due to that I'm checking files via steam, right now. Maybe tonight or tomorrow I can to take a look.
I know it has to do with sprite depth and so on, but I think it should not be matter of this, instead it should work as expected.
I have not touch anything, so don't know what's going on, so firts let me some time to solve it, since I want to as start point.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Oct 2019 18:51
Ok, fixed my issue.
This is what I'm getting so far:



Do you want to place your shade img behind the buttons images?
I should assume you are using shade image with the button image size? (502x74)

Quote: "yeah, like Belidos said with regard to style.txt."

So, I assume you already has to edited style.txt file.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 24th Oct 2019 22:05 Edited at: 24th Oct 2019 22:38
Thanks Pirate Myke

3com the shade is to be displayed full-screen behind the buttons.
Shade.png is a 256x256 semi-transparent image displayed fullscreen behind the buttons. Image attached below

Like so:

As you can see here it works, and it also does for Graphics and Sounds menus, but it does not work for LoadGame and SaveGame.

With regard to style.txt:
This is used by the engine to determine what folder your game's menu stuff is in.

So you open style.txt and type the name of the folder you want GG to use for menu screens when building standalone.

EDIT: not sure there is any point to getting the shade to work for LoadGame and SaveGame screens after all. Just tested, and the save\load feature is broken anyhow, sooo.....

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.

Attachments

Login to view attachments
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Oct 2019 23:45
I already know what the style.txt file does.
Ok, now I know what you want, I will test your image to see if there is luck.
I think some parts are still hardcode, ie: you can't run loadgame.lua from different path than "scriptbank/loadgame.lua", at least I can't.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 25th Oct 2019 00:03 Edited at: 25th Oct 2019 00:10
Cool will have a look thru that thread.

I don't have a loadgame.lua or a savegame.lua in scriptbank at all on my system, only place they exist is in the titlesbank folders.

Maybe that is why people are having problems with save\load games not working properly?

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 25th Oct 2019 00:59
Is this what you are looking for?



Quote: "Maybe that is why people are having problems with save\load games not working properly?"

I still haven't looked at the savegame.lua script, but loadgame.lua I run it from the scriptbank folder.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 25th Oct 2019 13:25 Edited at: 25th Oct 2019 13:33


Run both scripts from "scriptbank" folder.
Untested in standalone, just in test mode, but as you can see in the pics, it works.
hth

Edit:
Sorry I've missed something really important and a bit of tricky.
You'll has to resize or better redone yours shade img for every resolutions folders, ie: make shade image 1280x720 size, and store it in 1280x720 folder, the same with the other ones.

Note: ignore if standalone file run those scripts from scriptbank or default folder.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 25th Oct 2019 22:24 Edited at: 26th Oct 2019 12:56
@3com thanks for your input here - appreciated

LoadGame must be in the styles folder or the game locks up in Standalone build.

I don't see why the code I used in op works for gamemenu.lua, graphics.lua, and sounds.lua, but not for loadgame.lua and savegame.lua.

@Lee, since the same script is used for Main-Menu and In-Game Menu, is there some code, engine-side, that prevents a fullscreen image being displayed behind the Load and Save game screen buttons while in-game?

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2019 08:47
I must then assume that the files attached by me do not work well for you?
I thought the idea was to show your shade.png image behind the buttons.
Or I am wrong?
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 26th Oct 2019 12:50
3com thanks for your help
Did you try them in a standalone build?

I tried placing the LoadGame.lua in the scriptbank folder, but the Standalone game locks up - I guess GG expects them to be in the Styles Folder not in scriptbank for standalone games.

Or am I missing something here?

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2019 15:32
Quote: "Did you try them in a standalone build?"


Quote: "Note: ignore if standalone file run those scripts from scriptbank or default folder."


Sorry, I haven't any standalone build, still I don't have any reason to do one.
Anyway I'm going to make one standalone just 4 testing purpose.
Back when done.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2019 17:10
this is what I'm getting in standalone so far.









those fit your needs?

Wonder if changing backdrop for your own image may help to get the effect you are looking for.

Important note

Maybe we should assume GG running those scripts from scriptbank, just when in test mode.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 26th Oct 2019 21:34 Edited at: 26th Oct 2019 22:14
3com, thanks for your help
yes that is the effect I be after for in-game screen, but shade should not be displayed in Main-Menu

Obviously I must be missing something here:
- So do you have loadgame.lua in both Style Folder and Scriptbank?
- Also the SaveGame.lua you posted has no code for the shade at all, so how does it know to show it?

@Lee,
- why does the default savegame.lua have code to show the loading.png since it is never required
- and when in-game, how does the engine decide to not show the background for both savegame and loadgame
-

OldFlak....
aka Reliquia
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2019 22:41 Edited at: 26th Oct 2019 22:46
Look for "g_img_shade" on scripts.

Edit:
I am trying to attach a zip file with my standalone plus level maps, but getting error. I'm going to upload to some other server, back when done.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2019 23:12
Link drive

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-04-20 05:07:55
Your offset time is: 2024-04-20 05:07:55