Basic knowledge of the script

  • How the script works

    :!: WARNING: ITS NOT A 100% ACCURATE, but I do my best to make it as good as possible :!:

    1 Notification


    Notifications are sent with node-notifyer, and you can change the title and the message here:

    JavaScript
    notifier.notify({    title: 'Ace Logistics',    message: 'Tracker started.',    icon: "logo.png",    timeout: 1,    appID: "Ace Logistics - JobTracker"
    });

    1.1 Icon

    The icon has to be a PNG file, and it has to placed in the working directory or a subdirectory in the working dir (like this: /subfolder/logo.png)

    1.2 Timeout

    The timeout is self explaning its metric is seconds.

    1.4 App ID

    The appID is responsible for the small text in the top-left corner this is how it looks: k8zbyXwfli8.png

    2 Sending to server

    First we recive the data from ETCars, then we set the map variable var map = new XMLHttpRequest();, after that we assign all the information needed to a const, that we convert into a json file later, before sending the file, then we open a POST request map.open('POST', 'https://api.d1strict.net/al/v2/map', true); we also do some stuff that I can't explain (CyberLife please help) map.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); , here we convert our const (GeneralInformation) to a JSON file with this line:  var GeneralInformationJSON = JSON.stringify(GeneralInformation);  finally we send it to the server:


    JavaScript
    map.send(GeneralInformationJSON);

    3 Sending additional information

    You can include other information form the json file, all information:

    JSON
    {"status":"TELEMETRY","telemetry":{"pluginVersion":{"majorVersion":0,"minorVersion":15,"pluginVersionOnlyStr":"0.15.384.0"},"game":{"isMultiplayer":false,"paused":true,"isDriving":false,"majorVersion":1,"minorVersion":16,"gameID":"ets2","gameName":"Euro Truck Simulator 2","gameVersionStr":"Euro Truck Simulator 2 v1.16","gameVersionOnly":"1.16","nextRestStop":449,"gameDateTime":17474034,"gameDayTime":"Thu 17:54","gameDateTimeStr":"2034-03-23 17:54","osEnvironment":"Windows","architecture":"x64","localScale":3,"substances":["static","road","road_snow","dirt","snow","grass","road_dirt","invis","ice","metal","rubber","rumble_stripe","plastic","glass","wood","soft"]},"truck":{"cruiseControlSpeed":0,"gear":0,"gearDisplayed":2,"retarderBrakeLevel":0,"wipersOn":false,"make":"Renault","makeID":"renault","model":"T","modelID":"vehicle.renault.t","shifterType":"arcade","odometer":5233.12,"hasTruck":true,"engineEnabled":true,"electricsEnabled":true,"motorBrake":false,"parkingBrake":false,"speed":0.0161827,"engineRPM":550.001,"brakeTemperature":53.0499,"fuelRange":1989.85,"oilPressure":37.8978,"oilTemperature":65.2502,"waterTemperature":41.2943,"batteryVoltage":26.9795,"inputSteering":0,"inputThrottle":0,"inputBrake":0,"inputClutch":0,"effectiveSteering":-0.00413062,"effectiveThrottle":0,"effectiveBrake":1,"effectiveClutch":0,"hShifterSlot":0,"brakeAirPressure":129.625,"adBlue":57.5877,"dashboardBacklight":0.66,"maxEngineRPM":2100,"forwardGearCount":12,"reverseGearCount":3,"retarderStepCount":4,"trailerConnected":true,"worldPlacement":{"x":5216.81,"y":27.3818,"z":30049.2,"heading":0.738405,"pitch":-0.000274536,"roll":-8.34801e-7},"linearVelocity":{"x":-0.000171812,"y":-0.0000158248,"z":-0.000322461},"angularVelocity":{"x":0.0000235174,"y":-1.48002e-8,"z":-0.000136845},"linearAcceleration":{"x":-0.00000721805,"y":0.000299029,"z":-0.0000589673},"angularAcceleration":{"x":0.00000713564,"y":4.94545e-7,"z":-0.00000303833},"cabinOffset":{"x":0.000054833,"y":-0.00000178814,"z":0.00333524,"heading":4.20316e-9,"pitch":-4.55346e-7,"roll":-0.00000147987},"hookPosition":{"x":0,"y":1,"z":2.278},"headPosition":{"x":-0.7,"y":1.62771,"z":0.544893},"cabinAngularVelocity":{"x":-0.00344563,"y":4.91646e-7,"z":-0.00000391842},"cabinAngularAcceleration":{"x":0,"y":0,"z":0},"forwardRatios":[14.94,11.73,9.04,7.09,5.54,4.35,3.44,2.7,2.08,1.63,1.27,1,14.94,11.73,9.04,7.09,5.54,4.35,3.44,2.7,2.08,1.63,1.27,1,14.94,11.73,9.04,7.09,5.54,4.35,3.44,2.7,2.08,1.63,1.27,1],"reverseRatios":[-17.48,-13.73,-4.02,-17.48,-13.73,-4.02,-17.48,-13.73,-4.02],"wheelCount":6,"wheelInfo":[{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":-1.03,"y":0.5,"z":-1.64},"steerable":true,"simulated":true,"radius":0.506,"steering":-0.000434083,"rotation":0.170904,"powered":false,"liftable":false},{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":1.03,"y":0.5,"z":-1.64},"steerable":true,"simulated":true,"radius":0.506,"steering":-0.000437931,"rotation":0.844948,"powered":false,"liftable":false},{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":-0.93,"y":0.5,"z":3.1135},"steerable":false,"simulated":true,"radius":0.506,"steering":0,"rotation":0.452341,"powered":false,"liftable":true},{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":0.93,"y":0.5,"z":3.1135},"steerable":false,"simulated":true,"radius":0.506,"steering":0,"rotation":0.616932,"powered":false,"liftable":true},{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":-0.93,"y":0.5,"z":1.7545},"steerable":false,"simulated":true,"radius":0.506,"steering":0,"rotation":0.460361,"powered":true,"liftable":false},{"suspensionDeflection":0,"onGround":false,"substance":"static","angularVelocity":0,"lift":0,"liftOffset":0,"position":{"x":0.93,"y":0.5,"z":1.7545},"steerable":false,"simulated":true,"radius":0.506,"steering":0,"rotation":0.94237,"powered":true,"liftable":false}],"trailerPlacement":{"x":5208.94,"y":27.3677,"z":30048.6,"heading":0.738406,"pitch":-0.000358243,"roll":0.00000132809},"warnings":{"batteryVoltage":true,"airPressure":true,"airPressureEmergency":true,"oilPressure":true,"waterTemperature":false,"fuelLow":false,"adBlue":false},"damages":{"engine":0.035637,"transmission":0.0216958,"cabin":0.0557648,"chassis":0.069706,"wheels":0.0182959,"trailer":0},"lights":{"lowBeam":false,"highBeam":true,"frontAux":0,"beacon":true,"parking":false,"brake":false,"reverse":false,"leftBlinkerEnabled":false,"rightBlinkerEnabled":false,"leftBlinkerOn":false,"rightBlinkerOn":false,"roofAux":0},"fuel":{"capacity":765,"warningLevel":0.15,"consumptionAverage":0.473944,"currentLitres":636.753}},"navigation":{"distance":40.0684,"time":2.32956,"lowestDistance":0,"speedLimit":0},"job":{"cargoID":"lux_yacht","cargo":"Jacht - Queen V39","mass":9899.7,"income":25018,"destinationCityID":"venezia","destinationCity":"Venezia","destinationCompanyID":"lkwlog","destinationCompany":"LkwLog GmbH","sourceCityID":"ancona","sourceCity":"Ancona","sourceCompanyID":"marina_it","sourceCompany":"Marina","deliveryTime":17474432,"isLate":false,"timeRemaining":398,"onJob":false},"trailer":{"linearVelocity":{"x":0.0000973847,"y":0.0000425058,"z":0.000396765},"angularVelocity":{"x":0.000267773,"y":1.28152e-7,"z":-0.000100804},"linearAcceleration":{"x":0.00000383052,"y":0.0000957001,"z":-0.0000375241},"angularAcceleration":{"x":0.00000312432,"y":-5.70621e-9,"z":-0.00000339343},"wheelCount":6,"wheelInfo":[{"suspensionDeflection":-0.0015603,"onGround":true,"substance":"road","angularVelocity":-0.0000584276,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.395696,"powered":false},{"suspensionDeflection":-0.00157737,"onGround":true,"substance":"road","angularVelocity":-0.0000575423,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.998312,"powered":false},{"suspensionDeflection":0.00150091,"onGround":true,"substance":"road","angularVelocity":-0.000058404,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.0771645,"powered":false},{"suspensionDeflection":0.00148384,"onGround":true,"substance":"road","angularVelocity":-0.000057522,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.351845,"powered":false},{"suspensionDeflection":0.00440193,"onGround":true,"substance":"road","angularVelocity":-0.0000583798,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.466383,"powered":false},{"suspensionDeflection":0.00438486,"onGround":true,"substance":"road","angularVelocity":-0.0000574983,"position":{"x":0,"y":0,"z":0},"steerable":false,"simulated":false,"radius":0,"steering":0,"rotation":0.00156893,"powered":false}],"id":"scs_lowbed.ch_3x2esii","cargoAccessoryId":"scs_lowbed.motor_yacht","hookPosition":{"x":0,"y":1,"z":0}},"user":{"steamID":"76561198441144038","steamUsername":"karaadamka","DLC":{"DLC":[{"appid":"227310","name":"Euro Truck Simulator 2 - Going East!","available":true,"installed":false},{"appid":"231120","name":"Euro Truck Simulator 2 Demo","available":false,"installed":true},{"appid":"258460","name":"Euro Truck Simulator 2 - Halloween Paint Jobs Pack","available":true,"installed":false},{"appid":"266930","name":"Euro Truck Simulator 2 - Ice Cold Paint Jobs Pack","available":true,"installed":false},{"appid":"266931","name":"Euro Truck Simulator 2 - Prehistoric Paint Jobs Pack","available":true,"installed":false},{"appid":"292320","name":"Euro Truck Simulator 2 - Force of Nature Paint Jobs Pack","available":true,"installed":false},{"appid":"297790","name":"Euro Truck Simulator 2 - Metallic Paint Jobs Pack","available":true,"installed":false},{"appid":"297791","name":"Euro Truck Simulator 2 - UK Paint Jobs Pack","available":true,"installed":false},{"appid":"297792","name":"Euro Truck Simulator 2 - Irish Paint Jobs Pack","available":true,"installed":false},{"appid":"297793","name":"Euro Truck Simulator 2 - Scottish Paint Jobs Pack","available":true,"installed":false},{"appid":"301180","name":"Euro Truck Simulator 2 - Flip Paint Designs","available":true,"installed":false},{"appid":"304020","name":"Euro Truck Simulator 2 - Polish Paint Jobs Pack","available":true,"installed":false},{"appid":"304140","name":"Euro Truck Simulator 2 - Brazilian Paint Jobs Pack","available":true,"installed":false},{"appid":"304210","name":"Euro Truck Simulator 2 - Fantasy Paint Jobs Pack","available":true,"installed":false},{"appid":"304211","name":"Euro Truck Simulator 2 - USA Paint Jobs Pack","available":true,"installed":false},{"appid":"304212","name":"Euro Truck Simulator 2 - Scandinavia","available":true,"installed":false},{"appid":"304213","name":"Euro Truck Simulator 2 - Canadian Paint Jobs Pack","available":true,"installed":false},{"appid":"304214","name":"Euro Truck Simulator 2 - High Power Cargo Pack","available":true,"installed":false},{"appid":"318500","name":"Euro Truck Simulator 2 - German Paint Jobs Pack","available":true,"installed":false},{"appid":"318510","name":"Euro Truck Simulator 2 - French Paint Jobs Pack","available":true,"installed":false},{"appid":"318511","name":"Euro Truck Simulator 2 - Czech Paint Jobs Pack","available":true,"installed":false},{"appid":"318520","name":"Euro Truck Simulator 2 - Christmas Paint Jobs Pack","available":true,"installed":false},{"appid":"318521","name":"Euro Truck Simulator 2 - Raven Truck Design Pack","available":true,"installed":false},{"appid":"347190","name":"Euro Truck Simulator 2 - Norwegian Paint Jobs Pack","available":true,"installed":false},{"appid":"347210","name":"Euro Truck Simulator 2 - Danish Paint Jobs Pack","available":true,"installed":false},{"appid":"347211","name":"Euro Truck Simulator 2 - Swedish Paint Jobs Pack","available":true,"installed":false},{"appid":"347212","name":"Euro Truck Simulator 2 - Viking Legends","available":true,"installed":false},{"appid":"347213","name":"Euro Truck Simulator 2 - Russian Paint Jobs Pack","available":true,"installed":false},{"appid":"388470","name":"Euro Truck Simulator 2 - Cabin Accessories","available":true,"installed":false},{"appid":"388471","name":"Euro Truck Simulator 2 - Michelin Fan Pack","available":true,"installed":false},{"appid":"388472","name":"Euro Truck Simulator 2 - Japanese Paint Jobs Pack","available":true,"installed":false},{"appid":"388473","name":"Euro Truck Simulator 2 - PC Gamer DLC","available":false,"installed":false},{"appid":"388474","name":"Euro Truck Simulator 2 - Turkish Paint Jobs Pack","available":true,"installed":false},{"appid":"388475","name":"Euro Truck Simulator 2 - Wheel Tuning Pack","available":true,"installed":false},{"appid":"388476","name":"Euro Truck Simulator 2 - Italian Paint Jobs Pack","available":true,"installed":false},{"appid":"388477","name":"Euro Truck Simulator 2 - Schwarzmüller Trailer Pack","available":true,"installed":false},{"appid":"388478","name":"Euro Truck Simulator 2 - Rocket League Promo","available":false,"installed":true},{"appid":"388479","name":"Euro Truck Simulator 2 - Hungarian Paint Jobs Pack","available":true,"installed":false},{"appid":"461240","name":"Euro Truck Simulator 2 - Slovak Paint Jobs Pack","available":true,"installed":false},{"appid":"461241","name":"Euro Truck Simulator 2 - Spanish Paint Jobs Pack","available":true,"installed":false},{"appid":"461242","name":"Euro Truck Simulator 2 - Window Flags","available":true,"installed":false},{"appid":"461243","name":"Euro Truck Simulator 2 - Austrian Paint Jobs Pack","available":true,"installed":false},{"appid":"461244","name":"Euro Truck Simulator 2 - Mighty Griffin Tuning Pack","available":true,"installed":false},{"appid":"461245","name":"Euro Truck Simulator 2 - South Korean Paint Jobs Pack","available":true,"installed":false},{"appid":"461246","name":"Euro Truck Simulator 2 - Swiss Paint Jobs Pack","available":true,"installed":false},{"appid":"461247","name":"Euro Truck Simulator 2 - Chinese Paint Jobs Pack","available":true,"installed":false},{"appid":"461248","name":"Euro Truck Simulator 2 - Pirate Paint Jobs Pack","available":true,"installed":false},{"appid":"461249","name":"Euro Truck Simulator 2 - XF Tuning Pack","available":true,"installed":false},{"appid":"526950","name":"Euro Truck Simulator 2 - Lunar New Year Pack","available":true,"installed":false},{"appid":"531130","name":"Euro Truck Simulator 2 - Vive la France !","available":true,"installed":false},{"appid":"531131","name":"Euro Truck Simulator 2 - Heavy Cargo Pack","available":true,"installed":false},{"appid":"540720","name":"Euro Truck Simulator 2 - Finnish Paint Jobs Pack","available":true,"installed":false},{"appid":"540721","name":"Euro Truck Simulator 2 - Belgian Paint Jobs Pack","available":true,"installed":false},{"appid":"558240","name":"Euro Truck Simulator 2 - Dragon Truck Design Pack","available":false,"installed":false},{"appid":"558241","name":"Euro Truck Simulator 2 - Romanian Paint Jobs Pack","available":true,"installed":false},{"appid":"558242","name":"Euro Truck Simulator 2 - Australian Paint Jobs Pack","available":true,"installed":false},{"appid":"558243","name":"Euro Truck Simulator 2 - Valentine's Paint Jobs Pack","available":true,"installed":false},{"appid":"558244","name":"Euro Truck Simulator 2 - Italia","available":true,"installed":true},{"appid":"558245","name":"Euro Truck Simulator 2 - Special Transport","available":true,"installed":false},{"appid":"876980","name":"Euro Truck Simulator 2 - Portuguese Paint Jobs Pack","available":true,"installed":false},{"appid":"909640","name":"Euro Truck Simulator 2 - Dutch Paint Jobs Pack","available":true,"installed":false},{"appid":"925580","name":"Euro Truck Simulator 2 - Beyond the Baltic Sea","available":true,"installed":false},{"appid":"925650","name":"Euro Truck Simulator 2 - Space Paint Jobs Pack","available":true,"installed":false},{"appid":"933610","name":"Euro Truck Simulator 2 - Krone Trailer Pack","available":true,"installed":false}]}}},"jobData":{"status":3,"teleported":true,"wasSpeeding":false,"jobStartedEventFired":true,"isMultiplayer":false,"late":false,"onJob":false,"wasFinished":false,"wasTrailerDisconnected":false,"sourceCity":"Ancona","sourceCompany":"Marina","destinationCity":"Venezia","destinationCompany":"LkwLog GmbH","cargo":"Jacht - Queen V39","truckMake":"Renault","truckModel":"T","game":"Euro Truck Simulator 2","sourceCityID":"ancona","sourceCompanyID":"marina_it","destinationCityID":"venezia","destinationCompanyID":"lkwlog","cargoID":"lux_yacht","truckMakeID":"renault","truckModelID":"vehicle.renault.t","gameID":"ets2","gameVersion":"1.16","pluginVersion":"0.15.384.0","topSpeed":8.22365,"speedingCount":0,"income":25018,"trailerMass":9899.7,"distanceDriven":0.141113,"fuelBurned":0.565186,"fuelPurchased":0,"startOdometer":5232.98,"endOdometer":5233.12,"timeRemaining":398,"timeStarted":17474027,"timeDue":17474432,"timeDelivered":17474034,"collisionCount":0,"finishTrailerDamage":0,"startTrailerDamage":0,"deliveryX":5216.81,"deliveryY":27.3818,"deliveryZ":30049.2,"pickupX":10147.1,"pickupY":2.01097,"pickupZ":39911.6,"trailerDeliveryX":5208.94,"trailerDeliveryY":27.3677,"trailerDeliveryZ":30048.6,"trailerPickupX":10151,"trailerPickupY":2.00548,"trailerPickupZ":39904.8,"startEngineDamage":0.035635,"startTransmissionDamage":0.0216938,"startCabinDamage":0.0557648,"startChassisDamage":0.069706,"startWheelDamage":0.0182759,"finishEngineDamage":0.035637,"finishTransmissionDamage":0.0216958,"finishCabinDamage":0.0557648,"finishChassisDamage":0.069706,"finishWheelDamage":0.0182959,"totalEngineDamage":0.035637,"totalTransmissionDamage":0.0216958,"totalCabinDamage":0.0557648,"totalChassisDamage":0.069706,"totalWheelDamage":0.0182959,"totalTrailerDamage":0,"navigationDistanceRemaining":40.0684,"fuel":636.753,"odometer":5233.12,"engineDamage":0.035637,"transmissionDamage":0.0216958,"cabinDamage":0.0557648,"chassisDamage":0.069706,"wheelDamage":0.0182959,"trailerDamage":0,"realTimeStarted":1619967100449,"realTimeEnded":1619967251777,"realTimeTaken":151328}}

    Well thats a lot of stuff.


    To inculde more information use this formula in the  const GeneralInformation  or in  const JobInformation : 'example' = data.example.example;.


    4 Tray application

    The tray application is made possible by SYSTRAY2. First we define all the menus with this formula: const NewTrayButton = {}. There are four things we have to define: title, checked, enabled and items[]. Title is just a string so you can do: title: 'This is a title', . Checked is a bool, if true you can make "checkfields". Enabled is a bool true, it just sets the visibiltity of the button/checkfield. Items[] is for making multiple submenus they follow this formula:

    For more look up systray2 docs.

    After we have our menus and submenus, we just have to define the order of them like this:

    Now we also have to define what should a button do when clicked. There are two ways to do that first: using systray.OnClick. This one doesn't works for submenus (at least I couldn't get it to work with them). This is based on IDs, so can be a bit spagetty like, but this is how to use it:

    JavaScript: app.js
    systray.onClick(action => {
        if (action.seq_id === 0) { //Ace Logistics Homepage Button
            open('https://ace-logistics.uk');
        } else if (action.seq_id === 1) { //sumbit a job button
            open('https://d1strict.de/form-user-response/10-submit-a-job/');
        } else if (action.seq_id === 2) { //Help button
            open('https://discord.gg/WrMg4CmVve');
        }
    })

    The second way of doing this is to make a click() ?function? (I don't know what these are) when defining a menu. All you have to do is to add this line of code to you menu const:

    JavaScript: app.js
    click: () => {
            UpdateApplication();
        }

    And then we have to add the listener at the end of our code:

    JavaScript: app.js
    systray.onClick(action => {
        if (action.item.click != null) {
            action.item.click()
        }
    })

    (I'm going to add offline saving soon...)


    If I missed something or if you have any suggestions, feel free to tell me in the comments.

Share

Comments 3

  • I once put the lines of code in the correct BB-Code. ;-)