Hello
I'm trying to get my head around this new scripting system and it's going okay for now. At least we don't have to twist our brains with RPN anymore, but I actually find the old scripting language easier, maybe because I never did anything like Pascal. I have a problem here, I'm trying to make throttle that would be increased by 1 notch everytime you press the throttle button, but no matter what I do, it'll increase by 2 notches instead of 1 for every click. What am I doing wrong?
Code
- procedure Cockpit_OnButton(id: string; value: boolean);
- begin
- if (id = 'Throttle') then
- begin
- throttle_mode := throttle_mode_last + 1;
- throttle_mode_last := throttle_mode;
- end
- else if (id = 'Neutral') then
- begin
- throttle_mode := 0
- end
- else if (id = 'Brake') then
- begin
- throttle_mode := throttle_mode_last - 1;
- throttle_mode_last := throttle_mode;
- end
- else if (id = 'RailBrake') then
- begin
- end
- else if (id = 'MaxBrake') or (id ='EmergencyBrake') then
- begin
- end;
- end;
2nd question:
From the main-file I have this procedure:
But if I then wrote in the cockpit script to send the "id" (Throttle) to a specific procedure for the throttle mode:
... I keep getting an unknown identifier error when trying to pack the script!