Hallo,
Ich habe ein Problem. Bei der Programmierung meiner U-Bahn, mit genau 40 Türen, dachte ich mir, dass ich eine Funktion erstelle. Damit das script halt nicht ganz unübersichtlich wird. Nur krieg ich das irgendwie nicht hin und das Content-Tool wirft mir alle möglichen Fehlermeldungen entgegen, damit ich es ja nur nicht schaffe.
Kann mir vielleicht irgendwer helfen was beim Script nicht funktioniert, ich bin da bei funktionen in Pascal noch nicht so gewohnt.
Hier die notwendigen Teile des scripts (Für die Tür L1)
Code: Tueren.pas
- const
- DOOR_SPEED_S = 1;
- DOOR_LIFT_PART = 0.15;
- var
- ...
- Door_L1_pos: single;
- ...
- procedure DoorOpen(var Door_pos: single; var Door_pos_x: single; var Door_pos_y: single);
- begin
- begin
- if Door_pos < 1 then
- Door_pos := Door_pos + 1/DOOR_SPEED_S * Timegap
- else
- Door_pos := 1;
- end;
- if Door_pos < DOOR_LIFT_PART then
- begin
- Door_pos_x := Door_pos * 1/DOOR_LIFT_PART;
- Door_pos_y := 0;
- end
- else
- begin
- Door_pos_x := 1;
- Door_pos_y := (Door_pos - DOOR_LIFT_PART) * 1/(1-DOOR_LIFT_PART)
- end;
- end;
- ...
- procedure Tueren_SimStep;
- begin
- if ((TS_ZentralAuf_L.value) and (v_ground = 0)) then
- begin
- DoorLAll := 1;
- DoorLClose := 0;
- end;
- if ((TS_Freigabe_L.value) and (v_ground = 0)) then
- begin
- DoorL := 1;
- DoorLClose := 0;
- end;
- if (TS_Schliessen_L.value) then
- begin
- DoorLClose := 1;
- DoorL := 0;
- DoorLAll := 0;
- DoorL1 := 0;
- ...
- end;
- if (TS_DIR_Door_L1.value) then
- begin
- DoorL1 := 1;
- end;
- ...
- // Türe L1
- if ((DoorLAll = 1) or ((DoorL = 1) and (DoorL1 = 1))) then
- begin
- DoorOpen(Door_L1_pos; Door_L1_pos_x; Door_L1_pos_y);
- end;
- ...
Am Ende kommt auch noch das Schließen der Türe, aber da habe ich mich bei der Funktion/Prozedur noch nicht probiert.
(Falls Script-stücke fehlen, einfach bescheid sagen)
Kann mir da jemand helfen?