[solved] XML Scripting Challenge

Post Reply
peter&basti
Moderator
Posts: 6756
Joined: 09.01.2012, 22:09
Location: Vienna, Austria

[solved] XML Scripting Challenge

Post by peter&basti » 24.04.2018, 20:03

Hi Friends,

there is no section for XML Scripting in the english Forum ...

I got this interesting scripting challenge from user VikenSheth via PN today:
Hi Peter,

How are you ?

I need your help related to xml script for below mentioned scenario, I am not sure if this is possible in RR.

1) I would like to run schedule with help of 2 push button
2) For example ID of 1st push button will be "select schedule" upon pressing this button in text box ID " select schedule name" it should start showing the name of schedule's one after another which I have created in schedule option.
(eg:- press 1st push button in text box <schedule name> will come again press 1st button in same text box next schedule name should come <schedule name1> so on and so forth )
3) if there are total 5 schedule's then all the schedule should come one after another in the same text box with the help of pressing 1st push button and again it should go back to 1st schedule name after the last schedule has been displayed.

4) Now the 2nd button....."start schedule".
5)Automatic mode should start automatically
6)The display schedule in text box should start after placing the locomotive in block.

Regards,
Viken
I prefer a open discussion, therefore i invite all to add thoughts or solutions on this topic.
Last edited by peter&basti on 30.04.2018, 19:17, edited 1 time in total.

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 25.04.2018, 17:39

Hi Viken, moin Peter (peter&basti),
let me present a solution that is functioning, although it my not be very clever.
At first: starting a schedule in Rocrail requires a loco positioned in the starting block of the schedule.
This requirement is not part of Viken's request.
In my solution the block "bk001" is the start of all schedules.
The loco "V200" ist placed into block "bk001" by pressing the "Reset" button.
The "Increment" button increments (in a loop) throug all schedules.
The "Start" button starts the selected schedule with the loco being placed in block "bk001".

You may modify this example (or request modifications) at any time.

Expanding it to more schedules including starting blocks other than block "bk001" I would install one "Start" button per block and one starting script per block.

Have fun.
Kind regards
Hermann
You do not have the required permissions to view the files attached to this post.

VikenSheth
Posts: 26
Joined: 26.05.2016, 09:15

Re: XML Scripting Challenge

Post by VikenSheth » 26.04.2018, 12:54

Hi Hermann,

Thank you for sharing the files, however I need your help in making changes which are mentioned below.

1) Loco, I will assign manually to the block so request you to omit default start of any loco from block bk001
2) if there is any text written in regional language (xml script) request you to please change it to English.
3) Reset button request you to omit loco assigned into a block rest is fine.
4) Currently schedule is running in "govirtual" mode pls change it to "go".

Also note that when I press reset button in your plan file internet explorer page opens automatically.

Regards,
Viken

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 26.04.2018, 19:02

Hi Viken,
I will work it out.
Kind regards
Hermann

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 26.04.2018, 21:18

Hi Viken,
this has been modified within Version 1.1:
- all texts within xml-scripts have been converted to "english";
- within script ac_reset.xml preset locos of block bk001 has been removed;
- within script ac_SelSchRun.xml "govirtual" has been modified to "go".
Addionally:
- some route feedback definitions within some blocks have been corrected;
- added a check if a loco is present within block bk001 within script ac_SelSchRun.xml.
Have fun.
Kind regards
Hermann
You do not have the required permissions to view the files attached to this post.

VikenSheth
Posts: 26
Joined: 26.05.2016, 09:15

Re: XML Scripting Challenge

Post by VikenSheth » 27.04.2018, 10:56

Hi Hermann,

Thanks for the script, would like to one change in the script which I have mentioned below.

1) I would like to remove the dependency the block "bk001" so that I can just place the loco in block of my choice and start the schedule after pressing increment button and start to start the schedule.

Regards,
Viken

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 27.04.2018, 15:26

Hi Viken,
your wish might be a bit tricky. Let me explain:
- every schedule starts at a certain block;
- if a loco is placed in this starting block,
-- use and start the loco with this schedule;
-- otherwise do nothing.
Is this what you like to be implemented?

With your text:
- "... I can just place the loco in block of my choice ..."
a script will never be able to identify this one loco (if there is more then one loco present)!
Kind regards
Hermann

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 28.04.2018, 07:07

Hi Viken,
this has been modified within Version 1.2:
The "Reset" button initializes all variables.
The "Increment" button shows (in a loop) all schedules.
The "Start" button starts
- the selected schedule
- with the loco that is placed
- in first block of the selected schedule.
If there is no loco in first block of the selected schedule
- nothing is done.
Attention:
- it is not checked if the loco is allowed to run that schedule!
- this decision must be made by the user.
Kind regards
Hermann
You do not have the required permissions to view the files attached to this post.

VikenSheth
Posts: 26
Joined: 26.05.2016, 09:15

Re: XML Scripting Challenge

Post by VikenSheth » 28.04.2018, 19:37

Hi Hermann,

Thank you for the scripts, I will test and let you know you I need any further changes.

Regards,
Viken

VikenSheth
Posts: 26
Joined: 26.05.2016, 09:15

Re: XML Scripting Challenge

Post by VikenSheth » 30.04.2018, 16:38

Hi Hermann,

Thanks for the scripts, it working as expected.

Regards,
Viken

hermannk
Moderator
Posts: 1145
Joined: 06.07.2014, 12:32
Location: Kiel Germany

Re: XML Scripting Challenge

Post by hermannk » 30.04.2018, 18:48

Hi Viken,
thank you very much for your positiv feedback.
I ask Peter (peter&basti) to mark this thread as "solved".
@Peter: bitte stelle diesen Thread auf "[Erledigt] XML Scripting Challenge" - danke
Gruß
Hermann

Post Reply

Return to “XMLScripting & Aktionen (DE)”