• Welcome to SC4 Devotion Forum Archives.

DAMN Development Thread (formerly known as "Custom Submenus")

Started by daeley, November 12, 2007, 02:28:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Diggis

Quote from: star.torturer on May 27, 2008, 02:07:39 PM
Can I just ask.... the images linked to in the LTEXT files (the lot picture, i guess) can they be the PNG that is in the LOT file? or should it just be the same as the icon PNG?

my set is nearly finished :)

That was kind of the intent, but you can make it any file you want.

daeley

#241
Quote from: Warrior on May 27, 2008, 02:10:31 PM
Although I lost the plot here. :)

well since they say x > 1000 words/picture (or something similar)



the resource (PNG and LTEXT) files still go into the plugins, but the script goes into the special folder structure - that's how I set it up now, but that's open for discussion of course
due to some limitations with LUA (I've been unable to load in additional functional libraries) the folder structure has to be relative to the sc4 "program files" directory, and any folder structure inside the "my documents" folder can't be seen.

edit: just realised I can put it in the a subfolder of the "program files" Plugins folder, that way you can add the resources at the same place as the scripts

edit2: renamed the thread to DAMN Development Thread

edit3: here we go:



better? the .dat contains all game data (PNG's, LTEXT's mostly) and the definition script is separated in a .damn.lua file (yes, the extension matters)
1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!

Diggis

Brilliant, I love it.  Quick Question.  Is the LUA file a renamed DAT file, or is it something slightly different?  Do we still do it with the reader?

Jonathan

So, If the set comes in the folder of Recreation/Paths and trails/BSC Trails. But I want it say Transport/OTher.

Do I just move the .damn.lua file and the dat into the Transport/Other folder.

ANd that's pretty cool how you got it to recognize somthing that's not a dat (unless as Diggis says it's just renamed, but judging by the icon I'd say it isn't) and how it could be outside a plugins folder.

daeley

the lua file is just a plain text file.
it is loaded dynamically from the game's lua code, much like all the "dofile" command you see there in the code.

There's only one downside to this approach, because I couldn't get the lua filesystem library to work, you'll need to create an index file for all the folders, which needs to be rebuilt each time you change the folder structure or add files. I've made a script that can do that automatically (so no big deal to end-users I hope) but for now it only works under windows (as batch scripts tend to). I'll make one that runs on any platform.
1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!

Diggis

Quote from: daeley on May 28, 2008, 12:49:31 AM
the lua file is just a plain text file.
it is loaded dynamically from the game's lua code, much like all the "dofile" command you see there in the code.

There's only one downside to this approach, because I couldn't get the lua filesystem library to work, you'll need to create an index file for all the folders, which needs to be rebuilt each time you change the folder structure or add files. I've made a script that can do that automatically (so no big deal to end-users I hope) but for now it only works under windows (as batch scripts tend to). I'll make one that runs on any platform.

Great work.  There is always a downside to everything we have tried, and this seems like the smallest one so far.  :thumbsup:

JoeST

That sounds great,  :thumbsup: tho I atm think that the current implementation will work better for "n00bs" as there is no rebuilding and creation of directory structures, there is just 1 file

Joe
Copperminds and Cuddleswarms

Diggis

Quote from: star.torturer on May 28, 2008, 01:26:59 AM
That sounds great,  :thumbsup: tho I atm think that the current implementation will work better for "n00bs" as there is no rebuilding and creation of directory structures, there is just 1 file

Joe

We are looking at ways to overcome that at the moment, but I don't think it's a biggy really.

RebaLynnTS

Just a thought, do the actual sets have to be in the DAMN folder too, or just the LUA files?
Becca

Look for me at ... Becca At Bat

HandsOn

Quote from: RebaLynnTS on May 28, 2008, 07:19:08 PM
Just a thought, do the actual sets have to be in the DAMN folder too, or just the LUA files?
Hopefully not - I am currently writing an "SC4 Organizer" that "insists" that the game's plug-in folder remains as virgin as possible (game PNG's, DLL's & DAMN excepted, of course). Thus I'll be watching this space like a hawk..  $%Grinno$%


Why not visit The Empire MD
Just updated on July 2nd, 2008
And after the game's done.. - The Storyteller's Logbook

daeley

1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!


daeley

actually, it'll be simpler. Just need to rewrite a bit of code here and there.

problem is I'm at work right now $%#Ninj2
1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!

HandsOn

Quote from: daeley on May 29, 2008, 03:12:52 AM
then rewrite it so it allows lua's?  :D
Already did, I just need to know what else will go in - everything is cvonfigurable, but I would like to know what needs to be configured: so, there'll be LUA's, and afolder structure based on your menu structure. Anything else going in?


Why not visit The Empire MD
Just updated on July 2nd, 2008
And after the game's done.. - The Storyteller's Logbook


Diggis

Quote from: Warrior on May 29, 2008, 03:40:39 AM
Naughty Naughty :P
Generaly people at work do..well..work. ;D

That just shows that you are still at school.   :D  It's all an illusion.

jplumbley

Quote from: Diggis on May 29, 2008, 03:41:54 AM
That just shows that you are still at school.   :D  It's all an illusion.

Im still in school but I already know the meaning of work.  Work is that period in the day where you are required to be physically in a specific place for you to find any and every way to avoid actually do anything of use.  Although, once in a while the boss will ask you for something and you will have to do some work, but just enough so the boss to be happy with what you have done.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

HandsOn

Quote from: jplumbley on May 29, 2008, 09:01:40 AM
Im still in school but I already know the meaning of work.  Work is that period in the day where you are required to be physically in a specific place for you to find any and every way to avoid actually do anything of use.  Although, once in a while the boss will ask you for something and you will have to do some work, but just enough so the boss to be happy with what you have done.
Sorry, jp, but that last part only applies as a last resort - usually carrying a clipboard and (optional) peering depply engrossed at something arcane while mumbling jargon should deter any boss from adding to your obviously stressed-out workload..  :satisfied:


Why not visit The Empire MD
Just updated on July 2nd, 2008
And after the game's done.. - The Storyteller's Logbook

jplumbley

Quote from: HandsOn on May 29, 2008, 09:23:03 AM
Sorry, jp, but that last part only applies as a last resort - usually carrying a clipboard and (optional) peering depply engrossed at something arcane while mumbling jargon should deter any boss from adding to your obviously stressed-out workload..  :satisfied:

Ill see what I can do about getting that last post ammended... Im not promising anything, but it may take me a while, if it is possible at all.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

daeley

all right... it's beta file time :)

DAMN.zip contains the new files needed for now. Unzip this to your SC4 installation plugins folder - not in my documents plugins! You should get this:


where Plugins\DAMN\Root is the menu root and Plugins\DAMN\Support contains the indexer and new root file customMenu.dat
As you can see, there is one file "BSC Park Trails.dat" included, edited to the new system.

damn-developer.zip contains the new version of the template spreadsheet and code generator. Not much has changed, with this new version you add the file you're going to put the code on top of the spreadsheet instead of it's path. The code of the base file has been changed to link a file to a position in the menu tree.
If you want to quickly convert your sets already done, do the following: open the lua file with the reader and change the header

local menu = DAMenu.findItem("Recreation/Paths and Trails/BSC Trails")
if (menu == nil) then
    menu = DAMenu
    local submenu = menu.items["recreation"]
    if (submenu == nil) then
        submenu = DAMenu.addMenu(menu,"Recreation")
    end
    menu = submenu
    submenu = menu.items["paths and trails"]
    if (submenu == nil) then
        submenu = DAMenu.addMenu(menu,"Paths and Trails")
    end
    menu = submenu
    submenu = menu.items["bsc trails"]
    if (submenu == nil) then
        submenu = DAMenu.addMenu(menu,"BSC Trails")
    end
    menu = submenu
end

into

local menu = DAMenu.items["BSC Park Trails.dat"]

where "BSC Park Trails.dat" (quotes needed) is obviously the file where the lua resides.

>>>> don't forget to remove any previous version of customMenu.dat from your plugins! <<<<
1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!