Yezz007 Posted May 24, 2012 Share Posted May 24, 2012 (edited) This problem has been SOLVED, see my problem in the next page. Edited August 24, 2012 by Yezz007 Link to comment Share on other sites More sharing options...
Ashwin.Star Posted May 24, 2012 Share Posted May 24, 2012 (edited) It seems that your Basics are not Clear, read some Coding tutorial man, there are lots of reason for saying this ... wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN)if You don't know how to use conditions :CHECK //Cek dan muat modelwait 0ifPlayer.Defined($PLAYER_CHAR)jf @CHECKwait 1Model.Load(#HYDRA)Model.Load(#ARMY)038B: load_requested_models//...//jf @CHECK Don't load the models in loop wait 1jump @EXPLODE:EXPLODEwait 1 no need to jump to next label & many more Edited May 24, 2012 by Ashwin the new boy Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 24, 2012 Share Posted May 24, 2012 Also use "038B: load_requested_models" OR "Model.Available(#HYDRA)", what's up with everyone double checking lately? And why "wait 1", using "wait 0" won't kill you. Here's a bit of background info: :TEST // This will make the game freeze until the condition is trueif/*CONDITION*/ jf @TEST:TEST2 // This will make the game continue and check for the condition, wait 0 // Using 1 is kind of unnecessary your computer won't work faster than wait 0if/*CONDITION*/jf @TEST2 Also try to avoid using $GLOBALS and use [email protected] instead. Link to comment Share on other sites More sharing options...
Yezz007 Posted May 25, 2012 Author Share Posted May 25, 2012 (edited) This script make the game crash while at line 280-290. _____________________________________________________________________________________________ wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN) You mean i must use: wait 0if and//condition//condition//condition(multiple and all of them must true)jf @LABEL Right? But if use that, after compiled and then decompiled, the code will be like this: wait 0if //conditionif //conditionif //Condition(multiple)jf @LABEL So, i just think its fine and two of my Published mods are exactly like that and no crash. _____________________________________________________________________________________________ Also try to avoid using $GLOBALS and use [email protected] instead Yeah, i always avoiding using $GLOBALS but all [email protected] are already in used! ([email protected]@) At same time of course. _____________________________________________________________________________________________ no need to jump to next label Never found any tutorial that prevent me using that. But i will follow you. _____________________________________________________________________________________________ I want wait 1 is that not good? 1 ms I really want it wait 1 ms, i really want to delay it. Yeah, but i will not using it again for condition check. _____________________________________________________________________________________________ Don't load the models in loop Details please. _____________________________________________________________________________________________ ALL MODELS WERE SUCCESFULLY LOADED, ALL CONDITIONAL CHECK SUCCESFULLY PASSED(as exactly what i want) untill the line 285. And two of my CLEO script were succesfully executed with this EXACTLY and POSITIVE same structure without crash. 1. Loading Models in loop(like what you said) 2. Conditional Check like this: wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN) The CLEO script what i meant : My first My second But thanks for your time,...... I will try your suggestion. Edited May 25, 2012 by Yezz007 Link to comment Share on other sites More sharing options...
Deji Posted May 25, 2012 Share Posted May 25, 2012 Only the last of your conditions would have any effect, the way you're writing them. Link to comment Share on other sites More sharing options...
Yezz007 Posted May 25, 2012 Author Share Posted May 25, 2012 Only the last of your conditions would have any effect, the way you're writing them. You meant: wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN) But, if the previous condtion have no effect, the Model may failed to load...and i already tested it about 100 times before i create this thread, all models succes to load. ____________________________________________________________________________________________________ But, THE MAJOR PROBLEM FOUND!!! The game crash exactly at: :T_M2wait 1if and0118: actor $E1 dead0118: actor $E2 dead0118: actor $E3 dead0118: actor $E4 deadjf @T_M2 {If True, Crash. Because the below lines}wait 1Object.Destroy($block1)0948: create_explosion_at -2158.3027 -70.5639 35.1719 type 12 camera_shake 1.5 Marker.Disable([email protected]) Marker.Disable([email protected])Marker.Disable([email protected])Marker.Disable([email protected])Car.DriveTo($Tank1, -2232.1675, -75.207, 33.1719) {CRASH!!! IF I DELETE IT THE GAME DOES NOT CRASH!!!}wait 2500 {No, the game crash before passing this}Actor.DestroyInstantly($E1)Actor.DestroyInstantly($E2)Actor.DestroyInstantly($E3)Actor.DestroyInstantly($E4)wait 1000jump @T_M2_EX I think this is the right parameter: Car.DriveTo($CAR_VARIABLE, $X_DESTINATION_COORDS, $Y_DESTINATION_COORDS, $Z_DESTINATION_COORDS) And i put: Car.DriveTo($Tank1, -2232.1675, -75.207, 33.1719) But WHY? I already assigned the variable as a car: $Tank1 = Car.Create(#RHINO, -2037.9894, -70.1069, 35.1719) Local Variables are all assigned, the forward lines. Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 25, 2012 Share Posted May 25, 2012 If you want to use globals use numbers higher than $9000. You can also make this as a mission, if it's in mission format you can use up to 1024 locals. Look at: C:\Program Files (x86)\Sanny Builder 3\tools\CLEO3\cleo_examples\CustomMission.txt Right? But if use that, after compiled and then decompiled, the code will be like this: Don't decompile your own scripts. Using if and should compile your script correct, maybe you used to much conditions in 1 loop? Don't load the models in loop Details please. Use this: :LOADModel.load(#M4):CHECKwait 0if Model.available(#M4)jf @CHECK // Instead of jf @LOAD Car.DriveTo($Tank1, -2232.1675, -75.207, 33.1719) {CRASH!!! IF I DELETE IT THE GAME DOES NOT CRASH!!!} Try with a local, or maybe the tank is wrecked or something? Could you post the new script? Link to comment Share on other sites More sharing options...
Yezz007 Posted May 25, 2012 Author Share Posted May 25, 2012 (edited) No, i never want decompile the script after seeing the script structure get a Major changes. The Model loading...yeah i will soon fix it to better. About that the car is not wrecked since i see it with still moving and OH GOD it is so far...and unexpected... $block3 = Object.Create(981, -2394.4329, -70.2141, 33.6641)$block4 = Object.Create(981, -2604.6533, -70.8883, 3.7969)Object.Angle($block3) = 90.0Object.Angle($block4) = 90.0 After i deleted those lines (about line 350) and Label :T_M4_EX (about line 400) the game stop crashing! Variables error? But, i still have a question, if i change these lines above everything: // the header//...Model Load and checkjf @CHECKwait 1gosub @EXPLODE //jump @EXPLODE(before)if0112: wasted_or_busted // or > Actor.Dead($PLAYER_ACTOR)jf @SUCCESS // i will add 0A93:end_custom_thread at that labelwait 0jump @FAIL // i will cleanup everything and restart the script//....//and i will add 0051 at the end of label :Assault (the last label right now) The player can be killed at anytime, will it returned? Just like mission(wasted or busted, the thread restarted) ...there already too much conditions? ___________________________ What? if i want to use Global, must higher than $9000 ? The other reason why i use Global instead of reassigning the locals is: the name. Current Unbugged script : Here Edited May 25, 2012 by Yezz007 Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 25, 2012 Share Posted May 25, 2012 (edited) But, i still have a question, if i change these lines above everything: // the header//...Model Load and checkjf @CHECKwait 1gosub @EXPLODE //jump @EXPLODE(before)if0112: wasted_or_busted // or > Actor.Dead($PLAYER_ACTOR)jf @SUCCESS // i will add 0A93:end_custom_thread at that labelwait 0jump @FAIL // i will cleanup everything and restart the script//....//and i will add 0051 at the end of label :Assault (the last label right now) The player can be killed at anytime, will it returned? Just like mission(wasted or busted, the thread restarted) ...there already too much conditions? If you want it like a mission use the file I told you to use, it ends if the player is dead (automatically). If you want that in a script you have to constantly check if the player is dead. {$CLEO .cm}:MyMission thread "MyMission" gosub @MissionStart if wasted_or_busted then gosub @MissionFailed end gosub @MissionCleanup end_thread :MissionStart gosub @MissionPassed return :MissionPassedwait 500 01E3: text_1number_styled 'M_PASSD' 0 5000 ms 1 // MISSION PASSED! return :MissionFailed 00BA: text_styled 'M_FAIL' 5000 ms 1 // ~r~MISSION FAILED! return :MissionCleanup $ONMISSION = 0 // integer values mission_cleanup return You can start the mission by using this opcode: 0A94: start_custom_mission "MyMission" if it's in mission format you can use up to 1024 locals EDIT: Your names are compiled into numbers, numbers that are used by the game already. Edited May 25, 2012 by Bad.boy! Link to comment Share on other sites More sharing options...
Jack Posted May 25, 2012 Share Posted May 25, 2012 If you want to use globals use numbers higher than $9000. You can also make this as a mission, if it's in mission format you can use up to 1024 locals Does the same rule work for VC CLEO mission? And if that's the case then waht about timers - what are their local variable numbers? Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
Yezz007 Posted May 25, 2012 Author Share Posted May 25, 2012 But i hear i must make 2 script: 1. {CLEO .cs} for the trigger. 2. {CLEO. cm} for the mission file is that right? Check instantly the player dead is the only different? Oh here, you may not noticed: Current script Link to comment Share on other sites More sharing options...
Ashwin.Star Posted May 25, 2012 Share Posted May 25, 2012 $Tank1 = Car.Create(#RHINO, -2037.9894, -70.1069, 35.1719) I am not sure if this is correct way I prefer to use car.Create($tank1, #Rhino, -2037.9894, -70.1069, 35.1719) otherwise use the opcode 00A5: [email protected] = create_car #PONY at 0.0 0.0 0.0 for creating vehicles & this for making them drive 00A7: car [email protected] drive_to [email protected] [email protected] [email protected] 02C2: car [email protected] drive_to 2644.462 -2016.282 12.5547 0704: car [email protected] drive_to $X_BCE2_CHECKPOINTS([email protected],85f) $Y_BCE2_CHECKPOINTS([email protected],85f) $Z_BCE2_CHECKPOINTS([email protected],85f) Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 25, 2012 Share Posted May 25, 2012 (edited) If you want to use globals use numbers higher than $9000. You can also make this as a mission, if it's in mission format you can use up to 1024 locals Does the same rule work for VC CLEO mission? And if that's the case then waht about timers - what are their local variable numbers? As far as I know it doesn't apply for VC. If you decompile the main.scm from VC you can see that the highest local ever used is [email protected] In San Andreas main.scm it goes much higher in missions. I'm not sure how high the globals go in VC. But i hear i must make 2 script:1. {CLEO .cs} for the trigger. 2. {CLEO. cm} for the mission file is that right? Check instantly the player dead is the only different? Oh here, you may not noticed: Current script That and the 1024 locals, which you could use. If you decompile the main.scm, you see that the code contains 4 parts*, the header, all the threads, all the missions and all the external threads. R* used a special form in it's missions, it's easier and because they are the makers of scm, I would try to code the same way as they do. About you script, it still contains this, why didn't you change it?: 038B: load_requested_modelswait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN)if Model.Available(#MISSILE)if Model.Available(#RHINO)if Model.Available(#MINIGUN)if Model.Available(#DNB1)if Model.Available(#DNB2)if Model.Available(#AK47)if Model.Available(#MP5LNG)if Model.Available(#MICRO_UZI)if Model.Available(3267)if Model.Available(3279)if Model.Available(16095)if Model.Available(981) Please correct me if I'm wrong EDIT: * and the main loop if you count that as a different thing Edited May 25, 2012 by Bad.boy! Link to comment Share on other sites More sharing options...
Link2012 Posted May 25, 2012 Share Posted May 25, 2012 If you want to use globals use numbers higher than $9000. Don't do it, if the user uses a stripped main or modified main how can you be sure that the main.scm has space for $9000? And if it's a modified main, how can you be sure that $9000+ don't store important informations? And, SA main.scm stores important informations in $9000+. Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 25, 2012 Share Posted May 25, 2012 If you want to use globals use numbers higher than $9000. Don't do it, if the user uses a stripped main or modified main how can you be sure that the main.scm has space for $9000? And if it's a modified main, how can you be sure that $9000+ don't store important informations? And, SA main.scm stores important informations in $9000+. If it's modified all globals can store important info, that why he shouldn't use them. Anyway I thought that there were some gabs between globals. And I'm not sure if my main is modified or not (keeps crashing at 1 mission even when I start a new game. or when others play with my save file). Link to comment Share on other sites More sharing options...
Deji Posted May 25, 2012 Share Posted May 25, 2012 Only the last of your conditions would have any effect, the way you're writing them. You meant: wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN) But, if the previous condtion have no effect, the Model may failed to load...and i already tested it about 100 times before i create this thread, all models succes to load. Thats because you used 038B: load_requested_models Which loads all models instantly. Just because something works doesnt make it correct... To make things easier, dont argue my advice in the future... Link to comment Share on other sites More sharing options...
Wesser Posted May 25, 2012 Share Posted May 25, 2012 (edited) Original SCM allocated space for global variables is 43800. Assuming that each global takes 4 bytes and the resultant identifier (43800 / 4) is a 0-based value, the first undefined is 10950. That's why globals mustn't be used in CLEO, because setting new variables will fill the subsequent SCM data and errors may occur. Edited May 25, 2012 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 25, 2012 Share Posted May 25, 2012 Only the last of your conditions would have any effect, the way you're writing them. You meant: wait 1if Model.Available(#HYDRA)if Model.Available(#ARMY)if Model.Available(#MINIGUN) But, if the previous condtion have no effect, the Model may failed to load...and i already tested it about 100 times before i create this thread, all models succes to load. Thats because you used 038B: load_requested_models Which loads all models instantly. Just because something works doesnt make it correct... To make things easier, dont argue my advice in the future... Did he make those, or does he have very strange settings in Sanny Builder? Right? But if use that, after compiled and then decompiled, the code will be like this: The closest result to decompiling wrong that I can get is this: 0000: NOP :NONAME_200D6: if 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 0019: [email protected] > 0 004D: jump_if_false @NONAME_2 0A93: end_custom_thread From this: {$CLEO .cs}0000:if [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > [email protected] > 0hex 4D 00 01 FE FF FF FF 93 0Aend Link to comment Share on other sites More sharing options...
Yezz007 Posted May 26, 2012 Author Share Posted May 26, 2012 I am not arguing or against your advice guys, i just wanna know 'why my incorrect codes do not crash the game' (already answered) and 'why my codes crash the game not while reading the incorrect codes' (already fixed: decreased the Global Vars). Yeah, i already make this script to better as you suggested (only the model loading part) :LOADwait 1if and Model.Available(#HYDRA) Model.Available(#ARMY) Model.Available(#MINIGUN) Model.Available(#MISSILE) Model.Available(#RHINO) Model.Available(#MINIGUN) Model.Available(#DNB1) Model.Available(#DNB2) Model.Available(#AK47) Model.Available(#MP5LNG) Model.Available(#MICRO_UZI) Model.Available(#M4) Model.Available(#BMYBOUN) Model.Available(#WMYBOUN) Model.Available(#MICRO_UZI) Model.Available(3267) Model.Available(3279) Model.Available(16095) Model.Available(981)jf @LOADwait 1 You meant this is the correct? But the compiler fail to compile it...(9 condition Max) So i make it: :LOADwait 1if and Model.Available(#HYDRA) Model.Available(#ARMY) Model.Available(#MINIGUN) Model.Available(#MISSILE) Model.Available(#RHINO) Model.Available(#MINIGUN) Model.Available(#DNB1) Model.Available(#DNB2) Model.Available(#AK47)jf @LOADif and Model.Available(#MP5LNG) Model.Available(#MICRO_UZI) Model.Available(#M4) Model.Available(#BMYBOUN) Model.Available(#WMYBOUN) Model.Available(#MICRO_UZI) Model.Available(3267) Model.Available(3279) Model.Available(16095)jf @LOADif Model.Available(981)jf @LOADwait 1 To make the compiler success. Ahh,... wrong again? Why don't you tell me da correct? The total correction of Label :LOAD ____________________________________________________ Okay lemme think: 1.The point of 'do not use global vars for CLEO' is the 'Main.scm' already use it, and if i assign the assigned globals(.scm) at (.cs) , error will occur(the one of the problems is 'DO NOT USE THE SAME NAME' ?) 2. Globals take more memory than Locals. 3. and yeah i will decrease the use of the Globals. Even i may not using it again. 4. I will use (.cm) beacuse it provides more locals. 5. I must usw (.cs) to trigger the (.cm) ? (GTAModding.com) 6. 00A7 = Car.DriveTo.... Since if i compile and then decompile, 00A7 will be changed to Car.DriveTo Thats not problem a problem right now. Link to comment Share on other sites More sharing options...
Ashwin.Star Posted May 26, 2012 Share Posted May 26, 2012 (edited) your are doing right :LOADwait 1if and Model.Available(#HYDRA) Model.Available(#ARMY) Model.Available(#MINIGUN) Model.Available(#MISSILE) Model.Available(#RHINO) Model.Available(#MINIGUN) Model.Available(#DNB1) Model.Available(#DNB2) Model.Available(#AK47)jf @LOADif and Model.Available(#MP5LNG) Model.Available(#MICRO_UZI) Model.Available(#M4) Model.Available(#BMYBOUN) Model.Available(#WMYBOUN) Model.Available(#MICRO_UZI) Model.Available(3267) Model.Available(3279) Model.Available(16095)jf @LOADif Model.Available(981)jf @LOAD this is the Correct way to check for many conditions The point ..... error will occur(the one of the problems is 'DO NOT USE THE SAME NAME' ?) The error May occur > Not occur yet ( for me at lest) Actually all the Global var are in Integer for example if you use $2 & $3 instead of $player_Char & $Player_Actor the result will be same if you use global var in string/name, Sanny builder will auto compile to first undefined or Unused Interger //For normal SCM, global Var are defined in "Sanny Builder 3\data\sa\CustomVariables.ini" file // ----------------------------- If you next reply is > "When i decompile my script, the Global var are same as i put their name, they are not compiled as integer" My answer will be > press F10 & uncheck the option "Add extra info to the SCM" & them compile the script, so, next time when you will decompile it, you can see the Real name of Global var in Integer, except those which are Defined in that ini file. ------- Your Questions are really good & interesting, i am glad to give their answers Edited May 26, 2012 by Ashwin the new boy Link to comment Share on other sites More sharing options...
Bad.boy! Posted May 26, 2012 Share Posted May 26, 2012 00A7 = Car.DriveTo....Since if i compile and then decompile, 00A7 will be changed to Car.DriveTo That does Sanny Builder automatically, you can check "Write Opcodes" function in SB options to prevent it. Both ways are compiled the same. Globals take more memory than Locals. There is more space for globals than for locals (not sure), but they take the same amount of space. I must usw (.cs) to trigger the (.cm) ? (GTAModding.com) Something like this: {$CLEO .cs}0000::SNIFFERrepeat wait 0until 00F0: actor $PLAYER_ACTOR 1 near_point x y radius 3.0 3.0 stopped_on_footif and 0256: player $PLAYER_CHAR defined 044B: actor $PLAYER_ACTOR on_foot // You could leave this 03EE: player $PLAYER_CHAR controllable $ONMISSION == 0 then 0A94: start_custom_mission "Custom_Mission" $ONMISSION = 1 00BA: show_text_styled GXT 'CUSTOM_TEXT' time 1000 style 2 // Real string names can't be more than 8 chars repeat wait 0 until $ONMISSION == 0 0AB4: [email protected] = var 0 // This is used instead of a global // In your mission you have to set 0AB3: var 0 = 1 if passed // This could cause errors if this one is used in other cleo scripts, so you could use an other var // [email protected] = var 32 or something if [email protected] == 1 then 0A93: end_custom_thread else jump @SNIFFER endelse jump @SNIFFERend Link to comment Share on other sites More sharing options...
Yezz007 Posted May 26, 2012 Author Share Posted May 26, 2012 (edited) The error May occur > Not occur yet ( for me at lest)Actually all the Global var are in Integer for example if you use $2 & $3 instead of $player_Char & $Player_Actor the result will be same if you use global var in string/name, Sanny builder will auto compile to first undefined or Unused Interger //For normal SCM, global Var are defined in "Sanny Builder 3\data\sa\CustomVariables.ini" file // Those all variables at "CustomVariables.ini" are the Vars that i can use in CLEO? Or may crash if use the same name ($0-$10951)? Is "CustomVariables.ini" stores all vars that is being used by main.scm ? _______________ The (.cm) works, thanks Bad.boy! Edited May 26, 2012 by Yezz007 Link to comment Share on other sites More sharing options...
Yezz007 Posted August 18, 2012 Author Share Posted August 18, 2012 (edited) This post is no longer needed, see my problem below. Edited August 24, 2012 by Yezz007 Link to comment Share on other sites More sharing options...
Yezz007 Posted August 24, 2012 Author Share Posted August 24, 2012 Man i got a problem, my script just crashing and i dunno know the problemo. I need your favor please Please check my code. It is a CLEO mission (.cm) and crashed after line 125. Main Question: Why Crash? Link to comment Share on other sites More sharing options...
Deji Posted August 24, 2012 Share Posted August 24, 2012 To answer the common question... Yes, the behavior of the globals in CustomVariables.ini is more expected. The same conflict issue can occur with any var that can be used in more than one script, however. The only way it remains safe to use PLAYER_ACTOR, etc. is on the premise that no script will change its use. But I'd just stay away from globals altogether unless they are temporarily used in a way similar ti in the main.scm or you wanna hijack the SCM. 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