Jump to content

EricD

Mitglieder
  • Gesamte Inhalte

    34
  • Benutzer seit

  • Letzter Besuch

Alle erstellten Inhalte von EricD

  1. Hello Timba Problem: You want to use the "set variable" event as a trigger when you add an item to a table. Suggested solution 1: Each time you add an item to a table you should also change a "dummy" object variable e.g. Your table is called "ThisTable" Your "dummy" is the Trigger button "Trigger1" (but it could be ANY entity in your layout) Stage1: Create a "Switch is toggled" event for "Trigger1" containing: if ThisTable == nil then ThisTable = {} end table.insert(ThisTable, math.random() ) $("Trigger1").variables["ThisTable"] = ThisTable Stage2: Create an "Object variable is changed" event for $("Trigger1").variables['ThisTable'] containing: for k = 1, #ThisTable do print(ThisTable[k]) end Suggested solution 2: Why not get rid of "ThisTable" and always use $("YourEntity").variables['ThisTable"] instead? (Only do this when you need to detect when an item is added to the table) Hope this helps! Detect table insert.mbp Eric
  2. Hello Members If, like me, you enjoy editing a track to produce your own points you may be interested in the following. This allows you to produce curved points with the radius of your choice and track separation of your choice. The points have only two switch positions and so can be “toggled”. 1. Choose the value of your inner radius (R2). e.g. R2 = 500mm 2. Choose the distance between parallel tracks (D) e.g. D = 60mm 3. Calculate the value of the outer radius (R3) using R3 = R2 + D e.g. R3 = 500 + 60 = 560mm 4. Calculate the value of the blue curve (R1) using R1 = 2 x R2 - R3 e.g. R1 = 2 x 500 - 560 = 440mm 5. Calculate the length of the yellow straight track (L) using L = √3(R3 - R2) e.g. L = 1.732 x (560 - 500) = 103.92mm 6. Set up the 3 routes as follows: 7. Set up the 2 switches as follows: (For simplicity I have shown an example of a left 60 degree curved points in HO gauge) Here is layout containing the example above (Curved Left) and a mirror image (Curved Right) Curved Points.mbp Viele Grüße Eric
  3. Thank you both for clearing up that mystery! English also has such things e.g. "kinda" instead of "kind of"
  4. Hi Timba, I use the Chrome browser with Google Translate permanently switched on. It converts German into a strange version of English, but one that I can usually understand. One word that has defeated Google Translate is the German word "abba" which, unhelpfully, it translates into English as "abba" e.g. "Das klingt abba eher unrealistich" it translates as "That sounds abba rather unrealistic" Do you happen to know what "abba" means? (Not Abba, the pop group!) Regards Eric
  5. Sorry my French is not good enough to explain this. I hope English will do: To copy events from Layout2 into Layout1: 1. Load your Layout1 2. In Layout1 go to the menu "Edit" and choose "Paste From" then "Layout" 3. Select your Layout2 The entire Layout2 will appear next to Layout1. In the Events tree there is now an entry "Events (imported)" You can now delete Layout2 but this will affect any of the "Events (imported)" which refer to the deleted objects. Hope this helps!
  6. To have a variable of type "List" will be very useful. At the moment, as a work-around, I am having to use comma separated strings stored in text variables then converting them into lists using Lua. Do you know when the update which includes List variables will be available? Best wishes.
  7. --[[ This is the way to rotate an object that Neo has suggested: 1. Force the object to zero degrees 2. Rotate by required angle --]] if track.state == 0 then $("Arrow2").transformation.rotation = { x = 0 , y = 0 , z = 0 , w = 1 } $("Arrow2").transformation:rotateZ(math.rad(-120)) end if track.state == 1 then $("Arrow2").transformation.rotation = { x = 0 , y = 0 , z = 0 , w = 1 } $("Arrow2").transformation:rotateZ(math.rad(-60)) end
  8. Firstly please accept my apologies that I do not speak German. This is my first V5 layout which seems to work correctly. I have used many ideas from other members of the forum and so if you see any lua code that you recognize then all I can say to you is "Thank you". I think that version 5 is fantastic and it is a great pleasure to use. Previously I used my own Delphi programs to manually control my layouts but, for most things, I now prefer lua. I still use a small Delphi program to change the route data stored in the two labels. I welcome any comments/suggestions from other members. Attached (I hope!) "TwoTrains.mbp" TwoTrains.mbp
  9. I have been using the MBSClient.pas unit for Delphi for TCP/IP control of my layouts. I use it with a set of Delphi programs for external control of Trains, Signals, Points and Cameras when my layout is in full-screen mode. MBSClient.pas works with V4 for everything except selection of Locomotive cameras. MBSClient.pas works with V5 for everything except reading/writing object variables. In future, I intend to use Lua for automatic train control and my little Delphi programs for manual layout control when in full-screen mode. Regards Eric Danvers
×
×
  • Neu erstellen...