Not Lua but you guys probably have the answer at your fingertips.
I want to take a couple screenshots and put them in a briefing. The dialog is looking for an 'Href', I tried unsuccessfully to load the image from my computer and also from Googledrive. I'm thinking that maybe the image needs to be on the web somewhere, is that right?
What's the best way of doing this?
Thanks
HTML question
Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command
HTML question
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
-
KnightHawk75
- Posts: 1850
- Joined: Thu Nov 15, 2018 7:24 pm
RE: HTML question
So you are better off creating external files for your html and putting the following special designator in the empty briefing [LOADDOC]Some_Blue_Briefing.html[/LOADDOC], where Some_Blue_Briefing.html is a path relative to the scenario file to a html file, such that say your html was in a Assets sub folder [LOADDOC]Assets\Some_Blue_Briefing.html[/LOADDOC].
Sample Some_Blue_Briefing.html that loads images via most of the different ways you can choose to do it.
Can do the same for the overall title\description entry as well as far as [LOADDOC][/LOADDOC] goes.
Edited: added more examples.
Sample Some_Blue_Briefing.html that loads images via most of the different ways you can choose to do it.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /></head>
<body>
<P>Test external hrefs</P>
<IMG alt="http://something/SomeImage.png" src="https://www.somewhere.com/SomeImage.png">
<P>Test File ref 1</P>
<IMG alt="scenefolder\SomeImage.png" src="SomeImage.png">
<IMG alt="scenefolder\Assets\SomeImage.png" src="Assets/SomeImage.png">
<IMG alt="scenefolder\SomeImage.png" src="./SomeImage.jpg">
<IMG alt="scenefolder\Assets\SomeImage.png" src="./Assets/SomeImage.jpg">
<P>Assuming scene is in a subfolder with the path of [CMOInstallFolder]\Scenarios\KH\SomeSceneName</P>
<IMG alt="use image from db3000" src="../../../DB/Images/DB3000/Submarine_550_t1.jpg">
<P>Test File ref 2</P>
<IMG alt="scenfolder\SomeImage.png" src="file:./SomeImage.png">
<IMG alt="scenfolder\Assets\SomeImage.png" src="file:./Assets/SomeImage.png">
<P>Assuming scene is in a subfolder with the path of [CMOInstallFolder]\Scenarios\KH\SomeSceneName</P>
<IMG alt="use image from db3000" src="file:../../../DB/Images/DB3000/Submarine_550_t1.jpg">
</P></body></html>
Edited: added more examples.
RE: HTML question
The trouble with that approach, KnightHawk, is that you have to ensure that the end user gets the additional content installed in his or her machine. How do you handle distribution?
Command already has a decent mechanism for adding assets to a scenario in the Attachment Repository. Wouldn't it be nice if we could put an HTML directory tree into the system through the attachment mechanism?
The final file structure could look like the following:The Desc file would read something like the following:The load attachment function would need
the URL (which should be computed by the system and not directly visible to the user) would be:
file:\\Command_Path\AttachmentRepo\guid\scenarioName_sideName_brief.html
and could be loaded into an HTML capable control.
(like what the briefing window is)
Just a thought.[:)]
Command already has a decent mechanism for adding assets to a scenario in the Attachment Repository. Wouldn't it be nice if we could put an HTML directory tree into the system through the attachment mechanism?
The final file structure could look like the following:
Code: Select all
AttachmentRepo
+--guid (for some attachment)
+--guid (for some attachment)
+--guid (for the HTML tree attachment)
| +--desc.xml
| +--scenarioName_sideName_brief.html
| +--dir (referenced from the html files- can hold other html files or resources)
| | +--index.html
| | +--some_other_page.html
| +--dir (reference from the html files)
|
+--guid (for some attachment)Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<Attachment>
<Type>8</Type>
<Desc>HTML : scenarioName_sideName_brief.html</Desc>
<SFN>scenarioName_sideName_brief.html</SFN>
</Attachment>the URL (which should be computed by the system and not directly visible to the user) would be:
file:\\Command_Path\AttachmentRepo\guid\scenarioName_sideName_brief.html
and could be loaded into an HTML capable control.
(like what the briefing window is)
Just a thought.[:)]
-
KnightHawk75
- Posts: 1850
- Joined: Thu Nov 15, 2018 7:24 pm
RE: HTML question
Yup of course it does, but it also works today, I don't think I've ever got the build-in editor to display an image. I like your addition suggestion for being able to keep things all self-contained to the .scen for distribution, which is helpful for those users who can somehow still easily mess up a simple copy folder x to location y. [:)]
RE: HTML question
OK, so you're talking to a guy who has never created or done anything in HTML before - nada - zip - nothing...
So I guess the first question is - how do you build an HTML document? Is there a tutorial on that somewhere?
I see in some of the Standalone scenarios (like Downtown) there are files in 'Assets' directory which look pretty spiffy. In the editor the Scenario description has [LOADDOC]Assets\DownTown_Desc.html[/LOADDOC] and then the text - but that text is already in the html document?
So when I get the html document built and I package it up with the scenario - where does the user put it?
Remember -- I'm an old dog and these are new tricks..
B
So I guess the first question is - how do you build an HTML document? Is there a tutorial on that somewhere?
I see in some of the Standalone scenarios (like Downtown) there are files in 'Assets' directory which look pretty spiffy. In the editor the Scenario description has [LOADDOC]Assets\DownTown_Desc.html[/LOADDOC] and then the text - but that text is already in the html document?
So when I get the html document built and I package it up with the scenario - where does the user put it?
Remember -- I'm an old dog and these are new tricks..
B
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
RE: HTML question
Yeah, that IS the problem: where does the user put it? If they put it in the wrong spot, then it does not work. Should we trust the user to put it in the correct spot. How about not mucking with it, too? Generally, we can not trust the user. They alternately act like half crazed 2 year olds with 10 thumbs and genius hackers that could bring down the global financial system with a keystroke. Never trust the user.
The cool thing is that Command already has a system of distributing stuff with your scenario: it's called Scenario Attachments. All of them live in the attachment repo, which is managed by the system.
Wouldn't it be great if we could leverage that system to answer this issue? That is the gist of my suggestion above. Extend the attachment repo to handle the HTML file and its assets/images and so forth.
This is why I strongly suggest that
The cool thing is that Command already has a system of distributing stuff with your scenario: it's called Scenario Attachments. All of them live in the attachment repo, which is managed by the system.
Wouldn't it be great if we could leverage that system to answer this issue? That is the gist of my suggestion above. Extend the attachment repo to handle the HTML file and its assets/images and so forth.
This is why I strongly suggest that
-
KnightHawk75
- Posts: 1850
- Joined: Thu Nov 15, 2018 7:24 pm
RE: HTML question
Thousands all over the web (https://www.w3schools.com/html/default.asp is pretty popular), most any document editor these days will give an option to save as html, if looking at a tutorial though you want to keep to things that are supported in html 4.0 (not 5.0 as the in-game control is has basically Microsoft ie 8-9 level compatibility). In addition to tutorials there are hundred of html\wedpage editor available in-browser (google docs is very popular docs.google.com). That said, if you want to keep it really simple, you can type what you want into the usual in-game editor including inserting the images that will never show up while editing as placeholders, then select 'view|edit html', copy that and paste it between the body tags in the sample above, or those provided below in the attachment.ORIGINAL: Gunner98
OK, so you're talking to a guy who has never created or done anything in HTML before - nada - zip - nothing...
So I guess the first question is - how do you build an HTML document? Is there a tutorial on that somewhere?
Right. The scenio description with [LOADDOC]is basically saying...go get the html file at this location and display it.I see in some of the Standalone scenarios (like Downtown) there are files in 'Assets' directory which look pretty spiffy. In the editor the Scenario description has [LOADDOC]Assets\DownTown_Desc.html[/LOADDOC] and then the text - but that text is already in the html document?
If you want it in a sub folder of where your scene file is you can (like you see with Assets in some of the CMO stuff), but if you want to keep things very simple just put it in the same folder as whatever your scene is going into, and when doing href's just type the filename. I would advise (just in case the user is throwing both into the root of scenarios or something that the image file name be kinda unique though).So when I get the html document built and I package it up with the scenario - where does the user put it?
Remember -- I'm an old dog and these are new tricks..
B
So for example:
I have "MY Cool Scenario Name.scen" file it has two side called Yellow and Green.
Inside that scene I use the [LoadDoc] method as follows.
For the scene's Description [LOADDOC]MyCool_ScenarioName_Description.html[/LOADDOC]
For the Yellow side Briefing [LOADDOC]MyCool_ScenarioName_Briefing_Yellow.html[/LOADDOC]
For the Green side Briefing [LOADDOC]MyCool_ScenarioName_Briefing_Green[/LOADDOC]
I have folder called "My Cool Scenario" in the zip, inside it I place those 3 html files, 2 images, the scene file, and one style sheet file that without getting into all the details the 3 html files use to "pre-set" some stuff like the background color, it's a copy of what's used for quick-battles, (most online editors will embed that stuff into the html itself so don't sweat it for now).
The user can choose to just throw all contents inside "My Cool Scenario" into like <CMOInstall>\Scenarios\Community, or they can copy the folder itself to <CMOInstall>\Scenarios so it has it's own top level entry, or really where ever it is they want under <CMOInstall>\Scenarios, or where ever you tell them too, should work regardless.
I also included in the zip a "My Cool Scenario_Organized" folder, it shows the exact same as above only with storing everything but the scene file in an MyCoolScenarioNameAssets sub folders. In that case you'd tell them the same as above. The only difference in the .scen and .html files are the path locations, you can look at them to see the minor difference.
@jkgarner
I mean if one is THAT paranoid about the user, one can just build their own simple scene installer with InnoSetup or the even more basic InstallForge freeware for now, pulling the root path from "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Matrix Games\Command Modern Operations\installed to" to build their install path, provided it's also exists for Steam version installs.
- Attachments
-
- SampleScen..WithHTML.zip
- (18.41 KiB) Downloaded 26 times
RE: HTML question
Thanks KnightHawk & jkgarner
I'll give that a try this weekend.
Cheers
I'll give that a try this weekend.
Cheers
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/