Ik zocht laatst naar het voorsein en plaatste hem op de baan en zag dat hij rood toonde. Het voorsein zonder cijferbak toont als beste geel. Ik was even in de seinen aan het kijken maar kon het stukje waarin het sein rood kon en mocht tonen niet vinden. Heeft of weet iemand welk stukje je moet verwijderen zodat die voorseinen met cijferbak geen rood meer kunnen tonen. Heb her en der de code al wat opgeruimd. Maar kom er niet uit waar het staat. Ben er na een paar uur naar de code kijken wel even klaar mee.
Code:
// // CustomSignalScript.gs // Version: 1.5 // // Copyright (c) 2005 Rik Jongerius (RikJ) // // Do not distribute or use this script in you're own custom content without asking permision. // // Email: rikjongerius@hotmail.com // // Empty template to be filled for a specific signal. // Do not forget to use the correct derived_*.gs file! // // Changelog: // Date | Changes // ----------+-------------------------------------------- // 28-06-05 | Started with first implementation // 16-08-10 | First version for light signals // 16-08-10 | 1.5 Release //
include "gs.gs" include "Signal.gs" include "SignalScript.gs" include "interface.gs" include "common.gs" include "browser.gs" include "aspects.gs"
class CustomSignalScript isclass SignalScript { //Standard SignalAspect states define int AS_STOP = 0x00; define int AS_CAUTION = 0x01; define int AS_PROCEED = 0x02; define int AS_OUTOFSERVICE = 0x10; define int AS_ROZ = 0x20; define int AS_HALFSPEED = 0x11;
//Standard groupaspect states define public int GA_STOP = 0; define public int GA_CAUTION = 1; define public int GA_PROCEED = 2;
//standard individualaspect states define public int IA_STOP = 0; define public int IA_CAUTION = 1; define public int IA_PROCEED = 2;
//Signal types define public int GA_HOME_SIGNAL = 0; define public int GA_DISTANT_SIGNAL = 1; define public int GA_LINK_SIGNAL = 2; define public int GA_HOME_LINK_SIGNAL = 3;
//Invisible signal return modes define public int RETURN_CAUTION = 0; define public int RETURN_CAUTION_AS_PROCEED = 1; define public int RETURN_CAUTION_AS_STOP = 2;
//variables int ProceedMax40; //max speed = 40 km/h int ProceedMax60; //max speed = 60 km/h int ProceedMax80; //max speed = 80 km/h int ProceedMax100; //max speed = 100 km/h int ProceedMax120; //max speed = 120 km/h int ProceedMax130; //max speed = 130 km/h int CautionBrk40; //brake to 40 km/h int CautionBrk60; //brake to 60 km/h int CautionBrk80; //brake to 80 km/h int CautionBrk100; //brake to 100 km/h int CautionBrk120; //brake to 120 km/h int CautionBrk130; //brake to 130 km/h int CautionBrk40Distance; //brake to 40 km/h, but has not to be reached at next signal int CautionBrk60Distance; //brake to 60 km/h, but has not to be reached at next signal int CautionBrk80Distance; //brake to 80 km/h, but has not to be reached at next signal int CautionBrk100Distance; //brake to 100 km/h, but has not to be reached at next signal int CautionBrk120Distance; //brake to 120 km/h, but has not to be reached at next signal int CautionBrk130Distance; //brake to 130 km/h, but has not to be reached at next signal
bool _outofservice; bool _shortbrake;
//assets
//Functions
public void Init(void) { //Interface.Log("Init custom signal..."); inherited();
CautionBrk40Distance = Aspect.SetNextBrakingDistance(CautionBrk40,true); temp[0] = CautionBrk40Distance; RegisterAspects(CautionBrk40Distance,CautionBrk40Distance,temp,"SignalAspect Caution 40","Caution, brake to 40 km/h. Speed has not to be reached at next signal");
CautionBrk60Distance = Aspect.SetNextBrakingDistance(CautionBrk60,true); temp[0] = CautionBrk60Distance; RegisterAspects(CautionBrk60Distance,CautionBrk60Distance,temp,"SignalAspect Caution 60","Caution, brake to 60 km/h. Speed has not to be reached at next signal");
CautionBrk80Distance = Aspect.SetNextBrakingDistance(CautionBrk80,true); temp[0] = CautionBrk80Distance; RegisterAspects(CautionBrk80Distance,CautionBrk80Distance,temp,"SignalAspect Caution 80","Caution, brake to 80 km/h. Speed has not to be reached at next signal");
CautionBrk100Distance = Aspect.SetNextBrakingDistance(CautionBrk100,true); temp[0] = CautionBrk100Distance; RegisterAspects(CautionBrk100Distance,CautionBrk100Distance,temp,"SignalAspect Caution 100","Caution, brake to 100 km/h. Speed has not to be reached at next signal");
CautionBrk120Distance = Aspect.SetNextBrakingDistance(CautionBrk120,true); temp[0] = CautionBrk120Distance; RegisterAspects(CautionBrk120Distance,CautionBrk120Distance,temp,"SignalAspect Caution 120","Caution, brake to 120 km/h. Speed has not to be reached at next signal");
CautionBrk130Distance = Aspect.SetNextBrakingDistance(CautionBrk130,true); temp[0] = CautionBrk130Distance; RegisterAspects(CautionBrk130Distance,CautionBrk130Distance,temp,"SignalAspect Caution 130","Caution, brake to 130 km/h. Speed has not to be reached at next signal");
public int HandleCustomAspectChange(int SignalAspect, int AspectObject, int NextSignalAspect, int Direction) { int candidate; int brkvel = 0; int maxvel = 0; int tvel;
//CUSTOM !! CUSTOM !! CUSTOM !!
if (_outofservice) { return Aspect.OutOfService(); }
if (AspectObject == Aspect.Stop()) { return Aspect.Stop(); } if (Aspect.IsValid(NextSignalAspect)) { brkvel = Aspect.GetMaxSpeed(NextSignalAspect); }
maxvel = Aspect.GetMaxSpeed(SignalAspect);
tvel = Aspect.GetMaxSpeed(AspectObject);
if ((tvel != 0 and tvel < maxvel) or maxvel == 0) { maxvel = tvel; }
SignalAspect = Aspect.SetMaxSpeed(SignalAspect, maxvel); if (Aspect.IsValid(NextSignalAspect) and Aspect.GetSuperBasic(NextSignalAspect) != Aspect.Stop()) { SignalAspect = Aspect.SetBrakeSpeed(SignalAspect, brkvel); }
if ((brkvel and (maxvel == 0 or brkvel < maxvel)) or (Aspect.IsValid(NextSignalAspect) and Aspect.GetSuperBasic(NextSignalAspect) == Aspect.Stop())) { if (Aspect.GetSuperBasic(SignalAspect) == Aspect.Proceed()) { SignalAspect = Aspect.SetBasic(SignalAspect, Aspect.Caution()); } }
if (Aspect.GetSuperBasic(SignalAspect) == Aspect.Caution() and _NextSignalIsRailEnd) { SignalAspect = Aspect.ROZ(); }
if (Aspect.GetBrakingDistance(NextSignalAspect) and Aspect.GetBasic(NextSignalAspect) == Aspect.Caution() and (maxvel == 0 or (maxvel > Aspect.GetBrakeSpeed(NextSignalAspect) and Aspect.GetBrakeSpeed(NextSignalAspect) != 0))) { if (Aspect.IsValid(NextSignalAspect)) { SignalAspect = Aspect.GetWorstAspect(SignalAspect, NextSignalAspect); } }
maxvel = Aspect.GetMaxSpeed(SignalAspect); brkvel = Aspect.GetBrakeSpeed(SignalAspect); brakedist = Aspect.GetNextBrakingDistance(SignalAspect); switch(TAspect) { case AS_STOP: case AS_ROZ: case AS_OUTOFSERVICE: case AS_HALFSPEED: break; case AS_PROCEED: if (brkvel == 0) { TAspect = Aspect.SetMaxSpeed(TAspect, maxvel); } else if (maxvel > brkvel) //Max passing speed is larger then brake speed, so display brake speed + yellow -> more restrictive { TAspect = Aspect.SetBrakeSpeed(Aspect.Caution(), brkvel); } else //brake speed is lower dan max passing speed, no braking needed { TAspect = Aspect.SetMaxSpeed(TAspect, maxvel); } break; case AS_CAUTION: if (!brakedist or brkvel != 0) { TAspect = Aspect.SetBrakeSpeed(TAspect,brkvel); //Caution, set max speed of next signal; TAspect = Aspect.SetNextBrakingDistance(TAspect, brakedist); } break; default: break; }
public void HandleRequestModeInfo(Message Msg) { inherited(Msg); }
public void HandleRequestModeInfoDistant(Message Msg) { inherited(Msg); }
public int CustomReturnWorstAspect(int Aspect1, int Aspect2) { return Aspect.GetWorstAspect(Aspect1,Aspect2); }
public int CustomLinkInvisibleSignalMode() { return RETURN_CAUTION; }
//General description of object public string CustomBrowserSignalDescription() { StringTable strtable = me.GetAsset().GetStringTable(); return strtable.GetString0("description_html"); }
//Names etc to show on the object. Appearance public string CustomBrowserAppearanceSettings() { string html; html = "<tr><td width=10></td><td width=120></td><td width=370>" + HTMLWindow.CheckBox("live://property/csscript.outofservice",_outofservice) + "Block is out of service</td></tr>"; html = html + "<tr><td width=10></td><td width=120></td><td width=370>" + HTMLWindow.CheckBox("live://property/csscript.shortbrake",_shortbrake) + "Next signal is within braking distance</td></tr>"; return html; }
public void LinkPropertyValue(string p_ID) { string p_IDc; p_IDc.copy(p_ID); inherited(p_IDc); if (p_ID == "csscript.outofservice") { _outofservice = !_outofservice; } else if (p_ID == "csscript.shortbrake") { _shortbrake = !_shortbrake; } }
public string GetPropertyType(string p_ID) { if (p_ID == "csscript.outofservice") { return "link"; } else if (p_ID == "csscript.shortbrake") { return "link"; }
return inherited(p_ID); }
//save and load functions for all the settings:
public Soup GetProperties(void) { int i; Soup soup = inherited();
Gebruikers op dit forum: Geen geregistreerde gebruikers. en 4 gasten
Je mag geen nieuwe onderwerpen in dit forum plaatsen Je mag niet antwoorden op een onderwerp in dit forum Je mag je berichten in dit forum niet wijzigen Je mag je berichten niet uit dit forum verwijderen