¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

That Dr.Script thing - again!


 

HI All, Just joined.

?

I am waiting to get the new WiFi module so that I can update my DR5000, but in the meantime I was wanting to try out Dr.Script which (allegedly) is built into the DR5000.

I know that my setup is working properly because when I input a script like

POWER OFF

PAUSE 3000

POWER ON

LOG "I Paused for 3 seconds"

The unit powers on and off with the 3 second pause and I see the message in the log window.

However none of the DCC concerned commands seem to work - for example I have tried many permutations of:

TURNOUT 209 /

including quoting and non quoting the slash, making the number "0209" and even adding the optional timeout value like..

?

TURNOUT 4000 209 |

But nothing happens (yes, I can control that turnout from the Digikeijs GUI)

?

Am I correct in assuming that this facility was never really finished before Digikeijs folded?


 

A few people have tried Dr Script over the years (search the forum for 'script') but I think you're right - its capabilities were limited at best and you'd struggle to achieve anything useful with it. Having said that, the TURNOUT command should work. Dennis and I tried it a while back and, whilst it had some issues, it would throw a turnout. See this post...
/g/Digikeijs/topic/93143502

Ian


 

Thanks Ian, it's probably that 0 base thing then. I will try that again tomorrow using 208 instead of 209 and see if that works.

Do we know if Yamorc will be having a scripting language?


 
Edited

Yeah, that did it. Addressing Turnout 208 does it.? Since I believe that address 0 is? the broadcast-to-all address in DCC (?) this has to be a software bug and is probably indicative of the amount of testing that this software had - i.e. almost none!

The Windows GUI for DR5000 was also not very extensively tested - for example on my rig (which seems to be one version behind the latest/last version which Digikeijs put out) when you try to save a CV set the software pops up the "Open file" windows dialog gadget not the "save " gadget. Consequently there seems no way to do that save. So, again, that function could not have been tested at all!? Hopefully Yamorc is on a more stable footing and the tremendous potential of that product set can now be exploited with some more solid software.

?

Many thanks Ian.


 

Yes we do ( know )

yes we will ( have YD.Script ) ?


 

Thanks Karst.? Don;'t forget to reply to the ticket I put into the website over the weekend :-)


 
Edited

So, cos I am a sucker for a challenge i decided to see how far I could get with this (I now learn obsolete) version of Dr.Script.?

I wrote three scripts, Two of which worked but the third one I just can't seem to get the variable to decerement.? - but I think I'm probably giving up on this now!? :-)

1====Works=======

BEGIN:
GOSUB BLINK
PAUSE 1000
GOTO BEGIN

BLINK:
TURNOUT 513 |
PAUSE 1000
TURNOUT 513 /
PAUSE 1000
RETURN


2=====Works-==========
BEGIN:
GOSUB BLINK
PAUSE 100
GOSUB TOGGLE
PAUSE 1000
GOTO BEGIN

BLINK:
TURNOUT 513 |
PAUSE 1000
TURNOUT 513 /
PAUSE 1000
RETURN

TOGGLE:
TURNOUT 208 /
PAUSE 2000
TURNOUT 208 |
PAUSE 2000
RETURN

3=====Fails==========
VAR(10) COUNTER
$COUNTER = 10
LOG $COUNTER

BEGIN:
GOSUB BLINK
PAUSE 100
$COUNTER = $COUNTER--
# Also tried $COUNTER = $COUNTER - 1? and other permutations
LOG $COUNTER
IF ($COUNTER == 0) GOSUB TOGGLE
GOTO BEGIN

BLINK:
TURNOUT 513 /
PAUSE 1000
TURNOUT 513 |
PAUSE 1000
RETURN

TOGGLE:
TURNOUT 208 /
PAUSE 2000
TURNOUT 208 |
PAUSE 2000
$COUNTER = 10
RETURN


 

Alan,

that 0 thingy is?not a bug.

it¡¯s the official NMRA way of address numbering. ( and thus LocoNet )

then Lenz said 0=1¡­. And Roco reimplemented and said 5=1 ?

that¡¯s why I choose to follow original spec, and use internally a 0 based representation.


for the Software Versions 1.6.x some ¡°lesser God(s)¡° tried their luck¡­.?


i will of course try to make YaMoRC as robust as I can. One thing: We do test with 8 people ?


 

On Tue, Aug 1, 2023 at 04:25 PM, AlanRailwayMan wrote:
I wrote three scripts, Two of which worked but the third one I just can't seem to get the variable to decerement.?
Try COUNTER = $COUNTER - 1
I think you only need to prefix a variable with $ when you need its value.?

Ian


 

Thanks Ian,? I think that was one of the permutations I tried - but I ended up with $COUNTER containing something like "10 -1 -1 ...." or somesuch.

I'll have another go though,


 
Edited

Karst,

Aha! so it's the market dominating companies introducing standards creep/corruption again then! Seen that so often in the IT world.

On a similar notes, I was somewhat suprised to learn that a default (new out of box) decoder is not mandated to have address 3 at first power up. Several people have told me it was the standard, but I found the "Myths" list on NMRA and yep - it's a myth :-)

8 people doing testing should do the trick!? I expect you? could recruit a few more on this forum if you needed to :-)?


 

What is this list on myths that NMRA has published? Can you post the link to it please?

On Tue, 1 Aug 2023 at 20:37, AlanRailwayMan <alant123@...> wrote:

[Edited Message Follows]

Karst,

Aha! so it's the market dominating companies introducing standards creep/corruption again then! Seen that so often in the IT world.

On a similar notes, I was somewhat suprised to learn that a default (new out of box) decoder is not mandated to have address 3 at first power up. Several people have told me it was the standard, but I found the "Myths" list on NMRA and yep - it's a myth :-)

8 people doing testing should do the trick!? I expect you? could recruit a few more on this forum if you needed to :-)?

--

Many Thanks

Iain Morrison


 

Iain,

actually it's a DCC wiki that I reached from an NMRA page during a convoluted search trail.

Alan T

?


 
Edited

That did it - thanks Ian.? Also I figured out the IF statement that was giving an error as well.

So I think collectively we can say that the golden rules for dr.Script seem to be these:

1) $MYVAR accesses the contents of the variable but MYVAR assigns a value to it.


2) All computation or comparison operators (+ - == != etc) MUST be surrounded by spaces (i.e. "MYVAR = $MYVAR + 1" works but "MYVAR=$MYVAR+1" does not). If you leave off the spaces some strange string concatenation takes place.

3) The IF statement arguments must NOT Have a space after the IF keyword (i.e. "IF($THIS == $THAT) GOSUB SOMESUB"? will work, but "IF ($THIS == $THAT) GOSUB SOMESUB" does not and says there are missing arguments).

So, the fixed version of my Script 3 from up above looks like this and it works fine now.

?

3=========Works Now=========
# Once per second change the state of an LED connected to a decoder at accessory address 513
# Every tenth iteration change a point motor connected as TURNOUT 208 (shows as 209 on the DR5000 GUI) out and back again
VAR(10) COUNTER
$COUNTER = 10
LOG $COUNTER

BEGIN:
GOSUB BLINK
COUNTER = $COUNTER - 1
LOG $COUNTER
IF($COUNTER == 0) GOSUB TOGGLE
GOTO BEGIN

BLINK:
TURNOUT 513 /
PAUSE 1000
TURNOUT 513 |
PAUSE 1000
RETURN

TOGGLE:
TURNOUT 208 /
# Using a slowmo DCC Automation point motyor with built in decoder. Approx 2 seconds for full travel
PAUSE 2000
TURNOUT 208 |
PAUSE 2000
# Reload the counter for next iteration.
$COUNTER = 10
RETURN

Thanks for all the help guys, Not sure if this is worth anything now as Karst has confirmed that Yamorc will be doing a new and better implementation - but the info is here for the ages if anyone should need it! :-)


 

Hi Alan,

?

Did you ever see the Dr.Script Manual ??

?

Here a couple of lines about white-space :)?

2.3 Assignment lines

To assign values to pre-declared variables ( VAR ), an assignment line consists of:

<left-hand> = <right-hand>

Where <left-hand> is the name (case sensitive) of a previously defined variable

Where ¡¯ = ¡¯ is the assignment operator, surrounded with white-space (at least 1 space or tab before and at least 1 space or tab behind the ¡®=¡®)

Where <right-hand> is an expression of any literal, variable content or built-in function result.

<right hand> may contain the operators : ¡®+¡¯, ¡®-¡¯, ¡®*¡¯, ¡®/¡¯. For addition, subtraction, multiplication and division. In case these operators exist, Dr.Scripts splits the expression from left to right and evaluates the split parts from right to left.

?

Just if you don't have it, I attached it to this post :)

Greets,

Karst


 

Karst,
Well - yes I do have that PDF but I read that line as only applying to the "=" sign case - not all symbols - but yes, I should have extrapolated I suppose. But, I got there in the end :-)

?

Best regards

Alan T


 

Feature request for YaMoRC!

When writing the manual on scripting, in addition to defining rules and variables etc could you please put in some real world examples, such as changing points\turnouts etc.

It would really help someone like me with very limited experience in scripting, get started.

Thank you!
Adam