Jump to content

ademes

Mitglieder
  • Gesamte Inhalte

    131
  • Benutzer seit

  • Letzter Besuch

Beiträge erstellt von ademes

  1. hello,

    Here are the problems encountered when trying "user-defined" scripts.

    1. As one can see in the attached screens, I call the "user-defined" Grill giving only one parameter "vehicle" that is the trigger to the engine defined in the event "train enters track".  the parameter has been given the "object" as type. 
      The called script execute only one instruction : print (vehicle.name) and this results in a print "Nothing" as seen on the event trace.
    2. It seems to be impossible to communicate a table to the called script.

    Regards

    André

    Lua prob 2.GIF

    Lua prob 2b.GIF

    Lua prob 2c.GIF

  2. Hi Goetz

    Thank you for your help.

    1. vor 17 Stunden schrieb Goetz:

      But the timers, event variables and the event script come firs

      Even if it occurs in the same module?  Currently, I cannot sort the events in the sample i gave to you earlier.  Have I to put the "user-defined" event in a separate module to be able to sort it?

    2. vor 17 Stunden schrieb Goetz:

      Simply insert a delay command before the action.

      That's great and exactly What I need!  I didn't realized that the (same) action restart automatically after the delay.

    Regards

    André

  3. Hi Goetz,

    I have another problem : Look at the 2 Lua scripts, one in the case "train enters track" and the 2nd whem "timer expires".  The first one works good, but the second one gives an error condition "script error (10) : attempt to index a nil value (global 'vehicle')".  Is it because, as in V4, the trigger in the case of "timer expires" points only to the timer's name?

    Regards

    André

  4. Hi Goetz,

    The first situation, I already use it.

    The second situation (different triggers), I"ll try asap.  Just to know :

    1. when I define the "user defined" event under the first Event definition, the new event is physically placed after all other existent events and I cannot move it up to be placed as the first one in the list.
    2. Parameters : may I, for example, give the name of a vekicle and use it as an object?

    Thank you

    user_defined.gif

  5. vor 33 Minuten schrieb Goetz:

    see if this works, please

    Hi Goetz,

    Thank you and, of course, it works!  So my example was too simple, I guess.

    In fact, my concern is to build a table where some some gap may exists like, for example :

    Pos = {
      T1 = {0, , 1},                     This produce a Script error (10)
      T2 = {1, 0},
      T3 = {1, 1, 0}
    }

    Pos = {
      T1 = {0, nil, 1},                 This is OK for the syntax but produce an error while attempting to toggle with a nil value
      T2 = {1, 0},
      T3 = {1, 1, 0}
    }

    Pos = {
      T1 = {0, "" , 1},                This is OK for the syntax but "" is interpreted as 0 (zero)
      T2 = {1, 0},
      T3 = {1, 1, 0}
    }

    So, my final objective is to create a table to pilot my trains according to defined trajects; currently, I'm thinking and searching a good way to do that and tables seem to be the best solution.

    Regards

    André

  6. Hello Goetz,

    one question concerning the tables :

    Imagine a layout where you have 3 switches at the entry of a station.  To go to the plateform n°1, you only need the first switch; for plateform n° 2, one need switches 1 & 2 and to go to plateform 3, one need the 3 switches.

    I've build the Following table containing the pos required for the switches for the tree trajects T1, T2 and T3:
    Pos = {
      T1 = {0, track.variables["switch2"].state, track.variables["switch3"].state},
      T2 = {1, 0, track.variables["switch3"].state},
      T3 = {1, 1, 0}
    }

    where switch1, switch2 and switch3 are object variables (type = object) with the real name of the switches SW1, SW2 ans SW3

    and the actions

    trajet =  vehicle.variables["Trajet"]

    $("SW1").state = Pos[trajet][1]
    $("SW2").state = Pos[trajet][2]
    $("SW3").state = Pos[trajet][3]

    So only the needed switches are toggled.  But do you have another method to replace the "track.variables["switch3"].state in order to avoid the toggle of the unused switch?

    Many Thanks

    André

  7. Hello,

    Is there a way to apply the same value to a lot (list) of variables?  Something like :

    Set the value "#" to all "reserve" object variables  Or is it possible in Lua?

    When I switch the "start button", I first want to reset certain variables and captions to the initial value, for example setting the variable "reserve" present on every switches in the layout to the value "#".
    Thank you

    André

  8. vor einer Stunde schrieb Andy:

    So your old Trigger2 are now [track],

    Hi Andy and BahnLand,

    Thank you both for your explanations, but be sure that I'm learning V5 step by step and I'm aware of the new way to write down an Event, including the usage of the Keywords and the Triggers.  And so, I agree with Andy that his solution is ok.

    But the question I was asking is finally the following : the translation of the V4 formula gives a sequence of "wheels" that look strange to me as I cannot reproduce it from scratch.  That's it!  Am I so silly??

    This to say that it becomes urgent to explain more deeply all those new mechanisms and tips to the users.  Otherwise, you probably will be obliged to answer more and more to the same questions.  If I can help, just tell me how.

    Regards

    André

  9. vor 2 Stunden schrieb Goetz:

    Try the cog wheel next to the field. If the triggering object can be referenced, you'll find "Trigger" in the context menu attached to that cog

    Hi Goetz,

    You speak about Trigger as option for "variable extend"; I speak about Trigger as option for "Name Property".

    Please let me know if you are able to create from scratch the sequence shown in my example and how you do that. 

    This correspond to the instruction in V4 :
    Train enter a track/street : $_Trigger2._Name

    action : set variable             name : $($(_Trigger2._Name).switch1).status
                                                Value : $($(_Trigger2._Name).switch1).Reserve

    Thank you

    André

     

  10. Hello,

    I have a problem : when I open a layout from V4 into V5, a "set variable" has been translated into the result in the image below.
    But I cannot reproduce that sequence fron scratch in V5 as I don't seen the property "trigger" under the property "Property".

    Thank you

    André

    Trigger-variable.GIF

  11. Hello,

    I've the following questions concerning the events and espescially the new "IF" condition :

    1. When one goes from the event's conditions to Lua and changes something in the Lua script, is it possible to go back to the standard 3D conditions.  In the sample D Lua below, one can see that the buttons to go back are grised after I add the "else" condition in Lua.
       
    2. In the Demo V5, the "else" condition exists in the 3d event's definition (see "If-else-1") as confirmed in Lua (see "If-else-2").  The question is : why is the last action exeuted in the else condition; I see no difference between the conditions with the value 1 and 2 in the standard 3d development?
      Notice also that, here, one can switch from 3d to Lua and back.

       

    Thank you

     

    D Lua.GIF

    if-else-1.gif

    if-else-2.gif

  12. vor 46 Minuten schrieb Andy:

    can I answer one time without getting a question again

    Andy,

    First, you treat me as "silly" which is not very sympathetic!

    Next, please understand english!  I don't want to remove that button witch, you're right, is very important.  NO!  What I suggest is to change the physical  position of that button so that it become highlighted as it concerns ALL object's variables and not only one.
    I hope now that it is clear for you and, Andy, it is just a suggestion!  No more.

    Regards

    André

  13. vor 2 Stunden schrieb Andy:

    for such complex layouts like yours, think about moving from object variables to Lua-tables. You can convert them with a little bit of textprocessing in an external editor grabbing them from the exported EV of your V4 (for your V4-layout!). Believe me, that way you can handle them much better later (MBS<->externalEditor). It's worth to learn Lua. And don't ask me now how those tables have to look like, that depends how you plan to use them. Also, complex 'procedures' should also better be rewritten in Lua, for reasons that I am describing here all the way

    Hi Andy,

    For sure, I will come to LUA.  But in the mean time, I also try to understand how V5 is working >< V4.  And all I saw up to now enjoy me because the major changes made in V5 permits a lot of thing impossible in V4.
    During that task (learning), I discover some possible improvements and therefore I gave them as suggestions.  Not only for me, but for all users, beginners or not.

    And, Andy, a suggestion I just realize now is the following : aside the fully description of the functionnalities of V5, one should also open a "Tip" directory or thema in the forum where any user can pick-up good ideas to solve the encountered problems.  What do you think about that?

    Regards

    André

  14. Hi Neo,

    Just small suggestions concerning the variables :

    1. The button (see below) used to look to the variables now opens a window showing all variables included into the objects giving the possiblity to see, change, copy and delete all those variables.
      Suggestion : put that button elsewhere and no more attached to a specific object
    2. Even if copy one or more variables from on object to another, using multi-selection, it is not possible to make (export) a list of all these variables.
      Suggestion : permit the selection of more than one object from the list in order to put that selection into the clipboard.

    variable's button.gif

    variable's list.gif

  15. Hi Neo,

    Thank you for your answers :

    1. Export : ok to wait for the official version delivery.  You asked why to export : there could be some reasons like
      1. print
      2. read all events in one document
      3. if an additionnal butom "Import" comes with the export one (seems not being foreseen yet), the copy of some events may be done between different layouts
    2. Variable list : in V4, under the buttom "timer & variables", one can have a list of all variables (global as object.variables); in V5, this is no more available.  You suggest to right-clic on the special buttom on the corresponding objet, but this is not possible if the event window is open ==> an independant  list is then very usefull
    3. Trigger : if you have a condition "train enter track", vehicule = any, what will be the meaning of Trigger = vehicule?  Does it mean that one can address an engine using indirection from another engine?  this sound a little bit strange to me.

    Thank you and regards

    André

  16. Hello,

    I try to read the different interventions, but it is very difficult as they are written in german and translation takes time.  So, sorry if my questions were already posted and replied :

    1. In V4, there was a button to export the events in order, for example, to print them.  I don't find this option in V5
    2. In V4, one can use Trigger1 & 2, depending on the action or condition expressed; now, in V5, these were removed and replaced by Trigger but I have some difficulties to see how to use it now.  For example, in the demo furnished with V5, I discover that "vehicule located on track" has the following parameters :
      - Vehicule : Any
      - Trigger : one have the choice between "Vehicule", new track or last track  -  What is the meaning of these parameters ?

      - Name : name of the variable
    3. What is the differnece between "Variable" and "Variable (Extended)"?
    4. Is it possible to have a list of all variables and how?
    5. In general, is it possible to have a detailled description of the different parameters and the good way to use them?

    Thank you for your comprehension

    Rgards

    André

×
×
  • Neu erstellen...