xml image marker

Go down

xml image marker

Post by ebennekom on Fri Jan 19, 2018 12:17 am

Hi All

Browsing through the developer guide I found the text and texture based markers. Example was easy enough, however! Upon adding it to a testroute and launching the route, error reporting says:

" An early time was defined, but no message was specified in MarkerXML in pathtoxmlfile"
" A late time was defined, but no message was specified in MarkerXML in pathtoxmlfile"

Weird. Why would I need text in an image marker? No worries though, copied in the text from the example for the textbased xml in the documentation. But neh. Same result.

Can anyone please help pointing out what I'm doing wrong?

Call from the routefile:
1000, .Marker  ( Orxeta\SignalsNSigns\marker.test.xml; 200 ),

Content of xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ImageMarker>
        <Early>
 <Time>12:01</Time>
 <Text>Early</Text>
 <Image>tracknumbers.01.png</Image>
 </Early>
 <OnTime>
 <Time>12:05</Time>
 <Image>tracknumbers.02.png</Image>
 <Text>right on</Text>
 </OnTime>
 <Late>
 <Time>12:09</Time>
 <Text>Late</Text>
 <Image>tracknumbers.03.png</Image>
 </Late>
 <Distance>50</Distance>
 <trains>ACTS1251</trains>
  </ImageMarker>
</openBVE>

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by ebennekom on Thu Jan 25, 2018 1:50 pm

Hasn't anyone tried this and encountered the same issue?

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by graymac on Thu Jan 25, 2018 4:02 pm

Track.Marker FileName; Distance
FileName: The file name for the marker image, relative to the Object folder.
Distance: A non-zero floating-point number indicating the length for which the marker image is displayed, by default measured in meters.
▸ Behavior for Distance:
negative value: The marker image starts to display at the Track.Marker command, and ends -Distance meters after the Track.Marker command.
positive value: The marker image starts to display Distance meters before the Track.Marker command, and ends at the Track.Marker command.
This command shows a so-called marker image, which is displayed in the top-right corner of the screen. You can use these images for advisory or informational purposes. The RGB color of 64,64,64 inside the image is made transparent.
 
The image is usually in .png format (earlier program/route versions tended to use .bmp files). Below is code example from an Irish CSV route file:

avatar
graymac

Posts : 1948
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: xml image marker

Post by leezer3 on Fri Jan 26, 2018 12:34 am

Interesting Smile
I get the nasty suspicion that you've found a combo I hadn't thought of, and hence causing unexpected results.

Not in front of the code until tomorrow evening or Saturday, but I'd bet that using *both* a textual message and an image is confusing things.
As an interim measure, defining both separately (e.g. separate XML files) will likely work.

Graymac-
New feature, and predictably enough a new bug  Razz
One day, we'll have a perfect program with no flaws.......

leezer3

Posts : 1198
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: xml image marker

Post by ebennekom on Fri Jan 26, 2018 4:32 pm

Ghehehe, Yeah well. Actually it's even more confuzzling than that.

From the manual there's 2 ways to call an xml marker (i'm aware how to use the 'regular' implementation of markers, but really liked the idea of having early, ontime, too late messages there, so thats why I gave the xml marker a go.

So the two ways to call them should be
a. for an image marker:
.Marker FileName.xml


b. for a text marker:

.TextMarker Text; Distance; FontColor


Strike that your honor. The poor sod has no idea what he's on about.


The xml format associated with the image marker as per the manual looks like this:

Code:
<?xml version="1.0" encoding="utf-8"?>


<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">


    <ImageMarker>


        <Early>


            <Time>12:00</Time>


            <Image>tracknumber01.png</Image>


        </Early>


        <OnTime>


            <Image>tracknumber02.png</Image>


        </OnTime>


        <Late>


            <Time>12:10</Time>


            <Image>tracknumber03.png</Image>


        </Late>


        <Distance>200</Distance>


        <trains>ACTS1251</trains>


    </ImageMarker>


</openBVE>

No text used here, that was just me trying to conform to the error messages gotten when using the marker this way. So calling the beauty above like so:

1000, .Marker  Orxeta\SignalsNSigns\marker.test.xml,

resulted in 2 ingame warnings. the logfile listed them as:

17:17:14  An early time was defined, but no message was specified in MarkerXML C:\Program Files (x86)\openBVE\LegacyContent\Railway\Object\Orxeta\SignalsNSigns\marker.test.xml
17:17:14  A late time was defined, but no message was specified in MarkerXML    C:\Program Files (x86)\openBVE\LegacyContent\Railway\Object\Orxeta\SignalsNSigns\marker.test.xml

So that one doesn't work (me thinks, unless I've goofed something up of course).

Will follow up with the text based marker


Last edited by ebennekom on Fri Jan 26, 2018 5:26 pm; edited 2 times in total

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by ebennekom on Fri Jan 26, 2018 5:19 pm

So the textbase marker.

Called from the routefile like so:


Code:
4925,
    .sta La Nucia;12.0500;12.0510;1;1;1;ATS;;30;50;Orxeta\SCMTon.wav   
    .stop 0;5;5;0   
    .Marker Orxeta\SignalsNSigns\text.marker.test.xml,   

And the xml looks like this:


Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <TextMarker>
         <Early>
            <Time>12:03</Time>
            <Text>You are too early</Text>
        </Early>
        <OnTime>
            <Time>12:05</Time>
            <Text>Bang on time! Congratulations, you get to keep your job</Text>
        </OnTime>
        <Late>
            <Text>You are too late!</Text>
        </Late>
        <Distance>50</Distance>
        <trains>ACTS1251</trains>
  </TextMarker>
</openBVE>

Note how the train is due to arrive at La Nucia at 12:05 and should't receive an 'too early' warning until its within 50 meters of that station and earlier than 12:03 (at least thats how I figure it should work)

However, The 'too early' prompt comes up directly at gamestart while Im still at my initial station. But remains blissfully absent when arriving there where I want it to be.

I'm guessing 'under the hood' any command for an xml file is parsed the same way where the system eventhough the xml's are distinguishable by their <TextMarker> and <ImageMarker> tags does not seem to make that distinction at all ?

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by leezer3 on Sat Jan 27, 2018 12:06 pm

Right, I'm a little closer to understanding what's going on.

Bugs, and one documentation typo (In the text marker example, copy and paste error I think....) Sad


  • The time definitions should only be in Early and Late, not in OnTime; Logical really, as there's no such thing as on-time, just early and late Razz
  • Image markers seem to have been checking for Texture not Image. I've no idea how that happened, but both should work OK in the latest build.
  • The current code definitely doesn't allow you to have both image and text. Please use two markers for the time-being, I'll have to fiddle around and see if I can get that to work.
  • Distance was getting confused in some cases.....


https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2018-01-27.zip

With any luck, this might actually work Embarassed 
The documentation has also been corrected.

leezer3

Posts : 1198
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: xml image marker

Post by ebennekom on Sat Jan 27, 2018 8:36 pm

Awesome cheers

I've downloaded the latest build, put the marker call back into the route and low and behold, error reporting stated images could not be found! Perfect, so at least we now know it's actually looking for them AND no more complaints about text missing.

After correcting the images file paths the error log stays nice and clean. I haven't seen the images pop up yet but haven't had the time to make sure I've got it all right. Will do some more testing tonight and keep you posted.

Also, many thanks for all the afford you put into this bve stuff Leezer (could do with a thumbs up smilie or something)

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by ebennekom on Sun Jan 28, 2018 1:03 am

Time based image markers working correctly confirmed.

Please see attached screenies, and nevermind the horrible images used Smile







ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Re: xml image marker

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum