Adding an attachment

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

Adding an attachment

Post by DMAN »

Hi all,

I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.

I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')

I've created an event trigger: "Scenario is Loaded".
I've tried with and without conditions (and I think this is where the problem is).
I have my actions: LUA script (the line above) and a message, in this order.

I haven't used the console as mentioned on this board. I've been doing it all through the Editor.

I'm using a single overlay for now to test the process, so what you see above is what I am inputting.

The event triggers as expected, the event action message appears, but the overlay is absent, even if I start the scenario or switch sides (I want my overlays to appear for the player and not the AI).
The containing folder GUID is correct, and the required files are present.

Any tips?
Go easy; it's my first time with LUA.
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Adding an attachment

Post by Whicker »

you shouldn't need a condition, just the scen load trigger with your code above in the lua action. The overlay loads such that it is shown to all sides.

can you upload your scen so we can check it?
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: Whicker

you shouldn't need a condition, just the scen load trigger with your code above in the lua action. The overlay loads such that it is shown to all sides.

can you upload your scen so we can check it?

Hi Whicker,

I'll have to email it to you. It's a beast.
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Adding an attachment

Post by Whicker »

maybe you should try doing it with a small overlay to make sure what you are trying to do isn't too big? how big is the image?

are you attaching the image under Editor >> Scenario Attachments? sounds like you are.
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: Whicker

maybe you should try doing it with a small overlay to make sure what you are trying to do isn't too big? how big is the image?

are you attaching the image under Editor >> Scenario Attachments? sounds like you are.

Hi Whicker,

The scenario is very big.

The overlays are not so. There are many overlays to load when the scenario starts.

I've been practicing with just the one I posted, and no joy.

Yes, I am. Is this correct?
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Adding an attachment

Post by Whicker »

I think so.
Send it to me an I can have a look. I have only done it a couple times but it seemed straight forward.
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

Here is an example scenario showing how to load attachments with Lua.

The original designer required these to be manually added until Lua came along. I updated it to show how to use exsiting attachments as part of the scenario loading.
Attachments
WECDavos..rrorists.zip
(2.12 MiB) Downloaded 15 times
Michael
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

ORIGINAL: DMAN

Hi all,

I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.

I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
Is the folder '0a7490ae-0939-4b15-9631-0047a2f4e2fc' (which contains the attachment in the AttachmentRepo???
Michael
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: michaelm75au

ORIGINAL: DMAN

Hi all,

I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.

I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
Is the folder '0a7490ae-0939-4b15-9631-0047a2f4e2fc' (which contains the attachment in the AttachmentRepo???

Hi Michael,

Yes, it was.

I'll have a look at that example scenario you posted and see where I went wrong. Thanks! [:)]

More to follow...
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

If still an issue, send me the zip of the bundle, and I'll take a look at what is loading.
Michael
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: michaelm75au

If still an issue, send me the zip of the bundle, and I'll take a look at what is loading.

Hi Michael,

What needs to be in the bundle?

I tested with one overlay, and copied exactly what the test scenario had in the event. Still no overlay.
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

The SCEN file with the 'attachments' folder - the zip you should get when you run 'package scenario for distribution' from the editor.
Michael
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: michaelm75au

The SCEN file with the 'attachments' folder - the zip you should get when you run 'package scenario for distribution' from the editor.

Ok. It's a very large build. Can I pm or email it to you?
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

Yes, email it.
Probably better to jump in rather go back and forth with a cut-down version[:D]
Michael
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

ORIGINAL: michaelm75au

Yes, email it.
Probably better to jump in rather go back and forth with a cut-down version[:D]

Haha reap what you sow...

Can you pm your email please?
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

Hi Michael,

Fantastic! It works. Thank-you.

I think the critical step I missed was "re-add the overlay" each time. I simply added them from the repository and ran the package.

Can I continue to rename them or must they use that GUID?
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

They are designed to use the GUID as that is what gives it the unique name so it won't clash with someone else's attachments.
Michael
DMAN
Posts: 98
Joined: Fri Jan 11, 2019 3:56 am

RE: Adding an attachment

Post by DMAN »

Hi Michael,

Success with 2 tests!

I will now attempt the event in the actual build, with all overlays. [:)]
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

Using the 'Create new' in 'Scenario Attachments' in the editor should be creating the attachments in the AttachmentRepo and giving you the GUID to use in the Properties.
I am seeing that on my Beta copy but don't recall it in the release copy.


Image
Attachments
attachments2.jpg
attachments2.jpg (102.67 KiB) Viewed 837 times
Michael
User avatar
michaelm75au
Posts: 12457
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Adding an attachment

Post by michaelm75au »

FYI
When you create the image overlay (or any other attachment), it should show up in AttachmentRepo then. You can get the GUID from there and make a note which image it belongs to for updating the scripts.
It should be showing in the properties; not sure it isn't.

When you package it up, those folders are copied to the zip so others who install the scenario later will get the same attachments (and GUID).
Michael
Post Reply

Return to “Lua Legion”