rikgale / VRSCustomMarkers

Custom Aircraft Markers for VRS v3.0.x
Creative Commons Zero v1.0 Universal
3 stars 2 forks source link

Possbile to run Custom Markers with Change V3 SVG Marker Fill Per Criteria.html script? #44

Closed BallerG closed 1 year ago

BallerG commented 1 year ago

Is it possible to run the Custom Markers whilst also running the Change V3 SVG Marker Fill Per Criteria.html script, which can force markers to stay the same colour when selected? https://github.com/vradarserver/vrs-custom-scripts/blob/master/Change%20V3%20SVG%20Marker%20Fill%20Per%20Criteria/Change%20V3%20SVG%20Marker%20Fill%20Per%20Criteria.html

As an example, I have got it working with the HM Coastguard BE20 (see below), Police EC35's/P68 and the AS65 helicopter, but it's proving more difficult with others such as the A400 and Typhoon's these continue to default back to yellow

image

rikgale commented 1 year ago

I'm gonna go with "probably" - I did fiddle about with changing the selected colour based on criteria a couple of weeks ago and then side-lined it as "experiment successful, job done". It can be done in this script. I'll try and remember what I did - show you a proof of concept in the code and let you go on from there.

I do not really want this feature in the script as I prefer the selected a/c to be different colour when selected, but happy to show you the way.

BallerG commented 1 year ago

Thanks. That would be great if you could send the code.

rikgale commented 1 year ago

https://github.com/rikgale/VRSCustomMarkers/blob/main/MyMarkerTest.html

If you look in the MyMarkerTest.html Line 6 - 10 handle a basic scenario and turn all selected markers to be red. If you added other IF statements in there above line 8 then these would process and the if none of these were met it would default to a red selection.

BallerG commented 1 year ago

Thank you so much! That works.

rikgale commented 1 year ago

Glad it all works - if you copy all the markers stuff below the colours section in MyMarkers1 into your script you should end up with the marker shapes as well as you colours. Ofc, you may have figured this out already :)

BallerG commented 1 year ago

Thanks. Everything is working perfectly, including all the custom markers such as the EUFI marker

BallerG commented 1 year ago

From testing if(aircraft.isMilitary && aircraft.isMilitary.val) works fine, but if I try to add say air ambulances they are not really possible as it breaks VRS

rikgale commented 1 year ago

I've re-opened to remind me to have a play with this. Don't hold your breath waiting, but I will get there in the end.

BallerG commented 1 year ago

I have had a play with the coding and got it stable, but I'll need to test better tomorrow when more are up

rikgale commented 1 year ago

"From testing if(aircraft.isMilitary && aircraft.isMilitary.val) works fine, but if I try to add say air ambulances they are not really possible as it breaks VRS" - This might have had something to do with my poor regex usage. I have updated the test script. Anything with a space in the operator name should now work.

BallerG commented 1 year ago

Not sure if something within the test code is broken or not, but it just turns VRS blank when it's added to the plugin

My markers 1 file is ok

image

The test file when edited in to the main code goes blank

image

BallerG commented 1 year ago

Update. I now have the updated code working and will test it to see how VRS runs.

rikgale commented 1 year ago

If you dump the code you are using in this thread I will take a look.

BallerG commented 1 year ago

Here's my codes

This works OK

image

But when i add another such as police and or ambulance it breaks VRS after running for a while

image

rikgale commented 1 year ago

Can you put your code between ` So it looks like this

Before the if(aircraft.operator.val.match..... line

put if(aircraft.operator && aircraft.operator.val) {

and } after the if(aircraft.operator.val.match..... line

image

See what that does. If no joy I will try and have a play about tomorrow.

rikgale commented 1 year ago

It checks to see if the operator is valid first. If not valid the whole things throws a wobbly without that line in there.

BallerG commented 1 year ago

This is the coding lower down

image

rikgale commented 1 year ago

It needs to be in both sections - I'll do some clearer code tomorrow as about to be AFK for a while

BallerG commented 1 year ago

I have updated the coding as suggested and have it working at present

image

I shall monitor over the coming hours to see how it goes

rikgale commented 1 year ago

I've updated the MyMarkersTest script - and actually tested it this time. Replaced police and fire with Ryanair and easyJet for more options - also put mil in there as well, and tested that as well

BallerG commented 1 year ago

I have been running with the updated coding since last night and all remains OK so far with no freezing.

rikgale commented 1 year ago

As long as it is working for you then all is good. Are you happy for me to close this now?

BallerG commented 1 year ago

Everything seems stable at present, so I think it's fine to be closed.

Thanks for your help in solving it