HeresOtis Posted February 9, 2012 Share Posted February 9, 2012 I have a mod which loads various cleo scripts, with up to 25 script, not all loaded at the same time, but several will be loaded and running at the same time. A lot of the scripts are being ran externally using opcode 0A92. There's one main script then it loads external scripts and sometimes it crashes randomly. How many cleo scripts can be ran before the game crashes? Should I convert my scripts into a .scm and use Citizen Launcher? Can using .scm prevent crashes? What's the advantage of using .scm over .cs? Link to comment Share on other sites More sharing options...
ZAZ Posted February 10, 2012 Share Posted February 10, 2012 I have a mod which loads various cleo scripts, with up to 25 script, not all loaded at the same time, but several will be loaded and running at the same time. A lot of the scripts are being ran externally using opcode 0A92. There's one main script then it loads external scripts and sometimes it crashes randomly. How many cleo scripts can be ran before the game crashes? that's different depending to the amount of running threads and their data size some people told that they have 80 or more than 100 a cleoscript can run in more instances when it starts the own thread again the threads of main.scm are also relevant Should I convert my scripts into a .scm and use Citizen Launcher? i would take a total stripped main because then would run only 1 thread Can using .scm prevent crashes? if the reason is "to much threads" yes What's the advantage of using .scm over .cs? -can use global varaibles in a stable manner -can use ipl-objects -a missionscript can start a thread -the stuck car check works -the thread start procedure will be only done for one time at new gamestart -cleos will be started also by loading savegames then items like car_generators, objects can be set up in more insatance by saving-loading saves if the cleos of your mod place car_generators, objects, markers or pickups at scriptbeginn and never remove it then the scripts should have this opcode: 0A95: enable_thread_saving or cut and past the items into main.scm CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Deji Posted February 10, 2012 Share Posted February 10, 2012 Also, most mods that provide multiple CLEO scripts can be compiled down into one if coded correctly. Link to comment Share on other sites More sharing options...
HeresOtis Posted February 10, 2012 Author Share Posted February 10, 2012 i would take a total stripped main because then would run only 1 thread I downloaded the stripped main and source off your site. What parts do I edit to add my scripts? Link to comment Share on other sites More sharing options...
ZAZ Posted February 10, 2012 Share Posted February 10, 2012 i would take a total stripped main because then would run only 1 thread I downloaded the stripped main and source off your site. What parts do I edit to add my scripts? but it isn't a "total stripped main", it starts min. 10 threads anyway, it's allways the same: add the modthreads above of the first missionscript -add your script here//-------------Mission 0---------------// Originally: Initial 1// Sannybuilder marks by recompiling the first missionscript with the comment //-------------Mission 0:INITIALthread 'INITIAL' then place the create_thread codes where the other create_thread codes are placed this is a total stripped main DEFINE OBJECTS 1DEFINE OBJECT (dummyobject) // This is an unused object. You can put anything here.DEFINE MISSIONS 0DEFINE EXTERNAL_SCRIPTS -1DEFINE UNKNOWN_EMPTY_SEGMENT 0DEFINE UNKNOWN_THREADS_MEMORY 0//-------------MAIN---------------:MAIN_103A4: name_thread 'MAIN'016A: fade 0 (in) 0 ms042C: set_total_missions_to 0030D: set_total_mission_points_to 001F0: set_max_wanted_level_to 60111: set_wasted_busted_check_to 0 (disabled)00C0: set_current_time 23 004E4: unknown_refresh_game_renderer_at 2494.5 -1668.503CB: set_camera 2494.5 -1668.5 13.40053: $PLAYER_CHAR = create_player #NULL at 2494.5 -1668.5 13.407AF: $PLAYER_GROUP = player $PLAYER_CHAR group01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR0173: set_actor $PLAYER_ACTOR z_angle_to 7.00373: set_camera_directly_behind_player070D: $PLAYER_CHAR0629: change_stat 181 (islands unlocked) to 4 // integer see statdisp.dat01B6: set_weather 104BB: select_interior 0 // select render area01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)01B7: release_weather016C: restart_if_wasted at 2494.5 -1668.5 13.4 angle 180.0 unknown 0016D: restart_if_busted at 2494.5 -1668.5 13.4 angle 180.0 unknown 0016A: fade 1 (out) 1000 ms0001: wait 100 ms03E6: remove_text_box0180: set_on_mission_flag_to $ONMISSION // Note: your missions have to use the variable defined here:MAIN_30001: wait 2500 ms//end_thread0002: jump @MAIN_3 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
HeresOtis Posted February 10, 2012 Author Share Posted February 10, 2012 this is a total stripped main So, can I just copy and paste that and make a new main.scm, then add my scripts in the appropriate places? Link to comment Share on other sites More sharing options...
ZAZ Posted February 11, 2012 Share Posted February 11, 2012 this is a total stripped main So, can I just copy and paste that and make a new main.scm, then add my scripts in the appropriate places? Yes but place the script allways at the right place normal threads into MAIN PART, missionscripts into MISSIONSCRIPT PART, Externscripts into EXTERNSCRIPT PART the main should have this structure: TABLES of Objects, Missionscripts, ExternscriptsMAIN PART-Main thread-other threadsMISSIONSCRIPT PARTEXTERNSCRIPT PART CLEO MODS CLEO Script Tutorial 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