Scripts / (SOLVED) Some pro assistance in modifying the title.lua script to display random title images

Author
Message
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Mar 2017 17:08 Edited at: 6th Mar 2017 17:08
My scripting skills are not very good.
Here is were I am at the moment.


Only getting the first image displayed in the title screen.
Advice welcomed.

Thanks.
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.

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2017 17:35
you're reloading the image here when they are already loaded by you in the first part
Quote: "-- Added by Myke
--g_imgBackdrop = LoadImage("titlesbank\\" .. g_strStyleFolder .. "\\" .. g_strBestResolution .. "\\title.png")
math.randomseed( os.time() )
index = math.random(5, g_imgBackdrop )

g_imgBackdrop = LoadImage( index ) -- < this is reloading the image
g_sprBackdrop = CreateSprite ( index )"

also math.random(low,high)
so i think this should read
Quote: "-- Added by Myke
--g_imgBackdrop = LoadImage("titlesbank\\" .. g_strStyleFolder .. "\\" .. g_strBestResolution .. "\\title.png")
math.randomseed( os.time() )
index = math.random(0, 4 )
g_sprBackdrop = CreateSprite ( g_imgBackdrop[index] )"

lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Mar 2017 17:52 Edited at: 6th Mar 2017 18:57
Let me give this a try. Thanks.


EDIT:
Still only displays the first image. Will keep working at it.
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.

Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Mar 2017 22:14
So I went about it a different way and succeeded. Thank you smallg for trying to assist. I basically brute forced my way into the script. I am sure a gifted scripter can do this more efficiently.

The code for all that need it.


Remember to back up you title.lua file
You will need title.png,title1.png, title2.png, title3.png, and title4.png images in all your resolution folders of the titlesbank you choose.
NOTE: DO not just replace the title.lua script with this, if you do, then you will not have save and load function buttons.
Copy from the above between the **************** lines and insert into your title.lua script.
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.

Login to post a reply

Server time is: 2024-12-23 04:43:06
Your offset time is: 2024-12-23 04:43:06