Interface.Log won´t work

TomPolter

New member
I am trying to create own session rules with increasing success, but for debugging I can not use the function Interface.Log and need some help.
I am only able to get debug messages via Interface.Print, all messages via Interface.Log are not shown in my JetLog.txt.

I have Trainz 12 Build 61383 and already modified my trainzoptions.txt with:

-enablescriptlogging
-enablescriptmessagelogging

I also tried it with adding the -debug switch but with no success.

Does anyone have an idea what is wrong?
 
OK, intensive search in forum did help, I had to copy trainzoptions.txt into UserData folder.

Crazy file structure ...
 
Forget the interface class and use Andi's MessageBox (MB) class instead. See this thread. Probably the best debugging tool for Trainzscript so far.

You can look at the content of variables and soups while running in Surveyor or Driver. Needs TS12 SP1.
 
Forget the interface class and use Andi's MessageBox (MB) class instead. See this thread. Probably the best debugging tool for Trainzscript so far.

You can look at the content of variables and soups while running in Surveyor or Driver. Needs TS12 SP1.
That sounds good, I will try it out.

Thank you! :)
 
Forget the interface class and use Andi's MessageBox (MB) class instead. See this thread. Probably the best debugging tool for Trainzscript so far.

You can look at the content of variables and soups while running in Surveyor or Driver. Needs TS12 SP1.

@pcas1986. Can message box show the script messages from trackside items such as signals, trackmarks, triggers and junctions? I find those invaluable for the kind of scripts I write.
 
@pcas1986. Can message box show the script messages from trackside items such as signals, trackmarks, triggers and junctions? I find those invaluable for the kind of scripts I write.


I dug out one for for a lumber industry I made. It has a gate that is opened or closed when a train hits a trigger. I've removed some of the code to make it clearer. The debug stuff is commented out but you can see how it works. Looking at the code it seems I was evaluating a variable when a train left the industry.


Code:
 public void Init(void)
  {
    inherited();        // do the standard initialisation for a base industry
    useGenericViewDetails = true;
    
    // debug setup
      
    //    MB.SetParent(me,true);        // to disable alerts change true to false         //****
    //    AddHandler(me,"Browser-Closed","","MBHandler");                                 //****
    //    AddHandler(me,"Browser-URL","","MBHandler");                                    //****
    // end debug setup
   
    m_inQ      = GetQueue(strInQueue);
    m_outQ     = GetQueue(strOutQueue);
               
   ....
 
    
    // set up gate Handler
    AddHandler(me,"Object","","GateHandler");
       
   ...
    
    
  }   // end Init()



 // GateHandler looks after opening or closing the compound track gates. 
  void GateHandler(Message msg)
  {
      Vehicle vehicle = cast<Vehicle>msg.src;
      if (!vehicle) return;
          
      if (msg.minor == "Enter") {
         if (!gateOpen)
         { 
           gateOpen = true;
           SetMeshAnimationState("gates", true);
           
         }
      }
      else if (msg.minor == "Leave") {
         if (gateOpen)
         { 
           gateOpen = false;
           SetMeshAnimationState("gates", false);
           unLoaded = false;
           //MB.Alert("unLoaded set to false "); 
         }
      }
   } // end GateHandler()
 
Thanks for sharing that, Paul. I have tried out the message box code a while back but haven't used it much.

Cheers - Trevor
 
Back
Top