Dr. John Posted April 30, 2012 Share Posted April 30, 2012 I made another script and I am sure it will crash in missions so I was thinking how can I disable my script in missions so that the user doesn't gets any crashes? Link to comment Share on other sites More sharing options...
Bad.boy! Posted April 30, 2012 Share Posted April 30, 2012 You have to edit your script. Check if $ONMISSION is one and disable your script until $ONMISSION is zero. Link to comment Share on other sites More sharing options...
Ashwin.Star Posted April 30, 2012 Share Posted April 30, 2012 as bad.boY said make your script to be stuck in a loop while on you are in a mission :0wait 0if$ONMISSION == 0jf @0//// your script //// this code can be changed according to the need of Script Link to comment Share on other sites More sharing options...
Dr. John Posted April 30, 2012 Author Share Posted April 30, 2012 Should I put it above ////--------MAIN-------//// line or below? Link to comment Share on other sites More sharing options...
Frank.s Posted April 30, 2012 Share Posted April 30, 2012 (edited) Read some basic scripting tutorials before trying to do things that you don't understand. If you did, then you'd know the layout of a scm file and you'd know that from top to bottom it goes: Definitions - Main - All standard threads - Mission threads - External scripts. Edited April 30, 2012 by Frank.s Link to comment Share on other sites More sharing options...
Dr. John Posted April 30, 2012 Author Share Posted April 30, 2012 No, guys. The script isn't disabling. I am worried about mission Snail Trail. Here's the layout: // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------0000::0wait 0if$ONMISSION == 0jf @0thread 'TRAIN' [email protected] = 0 [email protected] = 0 :TRAIN_25wait 0 if Player.Defined($PLAYER_CHAR)else_jump @TRAIN_25 if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere -1982.125 -594.5937 25.7206 radius 100.5 100.5 50.5 else_jump @TRAIN_129 if [email protected] == 0 else_jump @TRAIN_179 [email protected] = 1 06D7: enable_train_traffic 0 jump @TRAIN_237 :TRAIN_129if [email protected] == 1 else_jump @TRAIN_25 [email protected] = 0 06D7: enable_train_traffic 0 07BE: remove_references_to_train [email protected] 07BE: remove_references_to_train [email protected] wait 0 jump @TRAIN_25 :TRAIN_179if and [email protected] == 1 [email protected] > 5300 else_jump @TRAIN_25 06D7: enable_train_traffic 0 07BE: remove_references_to_train [email protected] 07BE: remove_references_to_train [email protected] [email protected] = 0 wait 0 jump @TRAIN_25 :TRAIN_23701EB: set_traffic_density_multiplier_to 10000.0 Model.Load(#FREIGHT)Model.Load(#FREIFLAT)Model.Load(#STREAK)Model.Load(#STREAKC)wait 0 if or not Model.Available(#FREIGHT) not Model.Available(#FREIFLAT) not Model.Available(#STREAK) not Model.Available(#STREAKC)else_jump @TRAIN_306 jump @TRAIN_237 :TRAIN_30606D8: [email protected] = create_train_at -1981.207 -474.4401 25.7109 type 12 direction 0 06DC: set_train [email protected] acc 60.0 06DD: set_train [email protected] speed 70.0 wait 0 06D7: enable_train_traffic 0 06D8: [email protected] = create_train_at -1979.603 -678.1725 27.759 type 12 direction 1 06DC: set_train [email protected] acc 60.0 06DD: set_train [email protected] speed 70.0 [email protected] = 0 Model.Destroy(#FREIGHT)Model.Destroy(#FREIFLAT)Model.Destroy(#STREAK)Model.Destroy(#STREAKC)jump @TRAIN_25 Link to comment Share on other sites More sharing options...
Bad.boy! Posted April 30, 2012 Share Posted April 30, 2012 Don't decompile your scripts if you have to source code. Use this: :TRAIN_250001: wait 0 ms00D6: if0256: player $PLAYER_CHAR defined004D: jump_if_false @TRAIN_25if00FE: actor $PLAYER_ACTOR 0 (in-sphere)near_point -1982.1246 -594.5937 25.7206 radius 100.5 100.5 50.5004D: jump_if_false @TRAIN_13600D6: if0039: [email protected] == 0004D: jump_if_false @TRAIN_222if$ONMISSION == 0jf @TRAIN_25 0006: [email protected] = 1//00BC: show_text_highpriority GXT 'FEM_ON' time 3000 flag 1 // ON06D7: enable_train_traffic 00002: jump @TRAIN_248 Link to comment Share on other sites More sharing options...
Dr. John Posted April 30, 2012 Author Share Posted April 30, 2012 I tested it with the mission and I got a crash. So, I edited the script a bit and placed that opcode after Player_CHAR {$VERSION 3.1.0027}{$CLEO .cs}thread 'TRAIN'[email protected] = [email protected] = 0:TRAIN_25wait 0if Player.Defined($PLAYER_CHAR)else_jump @TRAIN_25if$ONMISSION == 0jf @TRAIN_25if00FE: actor $PLAYER_ACTOR sphere 0 in_sphere -1982.125 -594.5937 25.7206 radius 100.5 100.5 50.5else_jump @[email protected] == 0else_jump @[email protected] = 106D7: enable_train_traffic 0jump @TRAIN_237:[email protected] == 1else_jump @[email protected] = 006D7: enable_train_traffic 007BE: remove_references_to_train [email protected]: remove_references_to_train [email protected] 0jump @TRAIN_25:TRAIN_179if [email protected] == [email protected] > 5300else_jump @TRAIN_2506D7: enable_train_traffic 007BE: remove_references_to_train [email protected]: remove_references_to_train [email protected]@ = 0wait 0jump @TRAIN_25:TRAIN_237Model.Load(#FREIGHT)Model.Load(#FREIFLAT)Model.Load(#STREAK)Model.Load(#STREAKC)wait 0if or not Model.Available(#FREIGHT) not Model.Available(#FREIFLAT) not Model.Available(#STREAK) not Model.Available(#STREAKC)else_jump @TRAIN_306jump @TRAIN_237:TRAIN_30606D8: [email protected] = create_train_at -1981.207 -474.4401 25.7109 type 12 direction 006DC: set_train [email protected] acc 60.006DD: set_train [email protected] speed 70.0wait 006D7: enable_train_traffic 006D8: [email protected] = create_train_at -1979.603 -678.1725 27.759 type 12 direction 106DC: set_train [email protected] acc 60.006DD: set_train [email protected] speed [email protected] = 0Model.Destroy(#FREIGHT)Model.Destroy(#FREIFLAT)Model.Destroy(#STREAK)Model.Destroy(#STREAKC)jump @TRAIN_25 And now it's working well. Thanks to all. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now