Mysterdogg Posted September 30, 2018 Share Posted September 30, 2018 (edited) Hello everyone, I'm looking for a mod that could bring me a chronometer in-game. I'm currently working with some handling data lines and it's a bit inconvenient to use my phone to mark the times. If anyone can help me out finding the mod or even making it I'll be really pleased. Nothing too fancy, please. I need something basic. Edited June 3, 2019 by Mysterdogg Link to comment Share on other sites More sharing options...
ZAZ Posted September 30, 2018 Share Posted September 30, 2018 something like this? press T and M together to enable chronometer press G to start timer press H to stop timer press Backspace to quit chronometer {$CLEO .cs} :Chronometer thread 'TIMERCH' while true wait 0 if and 0AB0: key_pressed 84// t key ENABLE CHRONOMETER 0AB0: key_pressed 77// m key then repeat wait 0 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 00 // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 00 // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 0000 // value until 0AB0: key_pressed 71// g key START TIMER 0@ = 0 1@ = 0 33@ = 0 repeat wait 0 if 33@ >= 1000 then 0@ += 1 33@ = 0 end if 0@ >= 60 then 1@ += 1 0@ = 0 end 0085: 3@ = 33@ 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 1@ // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 0@ // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 33@ // value until 0AB0: key_pressed 72// h key STOP TIMER repeat wait 0 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 1@ // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 0@ // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 3@ // value until 0AB0: key_pressed 8// key = Backspace QUIT CHRONOMETER end end CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Mysterdogg Posted September 30, 2018 Author Share Posted September 30, 2018 (edited) Spoiler 1 hour ago, ZAZ said: something like this? press T and M together to enable chronometer press G to start timer press H to stop timer press Backspace to quit chronometer 2 {$CLEO .cs} :Chronometer thread 'TIMERCH' while true wait 0 if and 0AB0: key_pressed 84// t key ENABLE CHRONOMETER 0AB0: key_pressed 77// m key then repeat wait 0 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 00 // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 00 // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 0000 // value until 0AB0: key_pressed 71// g key START TIMER 0@ = 0 1@ = 0 33@ = 0 repeat wait 0 if 33@ >= 1000 then 0@ += 1 33@ = 0 end if 0@ >= 60 then 1@ += 1 0@ = 0 end 0085: 3@ = 33@ 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 1@ // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 0@ // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 33@ // value until 0AB0: key_pressed 72// h key STOP TIMER repeat wait 0 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 300.0 'NUMBER' 1@ // value 045A: text_draw_1number 60.0 300.0 'NUMBER' 0@ // value 045A: text_draw_1number 100.0 300.0 'NUMBER' 3@ // value until 0AB0: key_pressed 8// key = Backspace QUIT CHRONOMETER end end Thanks, Zaz! it worked just how I wanted! but could it be possible to set a specific speed as the stopper? for example 60 mp/h (100 km/h). Edited September 30, 2018 by Mysterdogg Link to comment Share on other sites More sharing options...
ZAZ Posted October 1, 2018 Share Posted October 1, 2018 You mean, if car reaches a specific speed, then stop timer? CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Mysterdogg Posted October 1, 2018 Author Share Posted October 1, 2018 5 minutes ago, ZAZ said: You mean, if car reaches a specific speed, then stop timer? That's right, that's just what I said. Could that be possible? I did a (really) quick check of the opcodes but couldn't figure out how to do it. Link to comment Share on other sites More sharing options...
ZAZ Posted October 1, 2018 Share Posted October 1, 2018 Ok, now Chronometer only works if CJ is driving a vehicle So get into a vehicle, press T and M together to enable chronometer press G to start timer Specified speed stops timer or press H to stop timer press R to reset timer press Backspace or leave vehicle to quit chronometer var [email protected] is speed output of vehicle this is the current speedcheck to stop timer: 6@ >= 45.0 I don't know if speed output is equal to km/h or miles/h or whatever So you can use the 2nd speed out put and multiplicate it with your own multiplicator to display a real speed value in 3.row 0085: 8@ = 6@ 8@ *= 1.2 // 2nd speed output by multiplicator 0092: 8@ = float_to_integer 8@// convert 2nd speed output into integer Also, it needs to convert float from speed output into integer for displaying The display: 1. row = timer 2. row = speed output 3. row = 2nd speed output by multiplicator {$CLEO .cs} :Chronometer thread 'TIMERCH' while true wait 0 if 0256: player $PLAYER_CHAR defined then if and 00DF: actor $PLAYER_ACTOR driving 0AB0: key_pressed 84// t key ENABLE CHRONOMETER 0AB0: key_pressed 77// m key then 0@ = 0 1@ = 0 33@ = 0 4@ = 0 03C0: 5@ = actor $PLAYER_ACTOR car while 0256: player $PLAYER_CHAR defined wait 0 if or 80DF: not actor $PLAYER_ACTOR driving 0119: car 5@ wrecked 0AB0: key_pressed 8// key = Backspace QUIT CHRONOMETER then break end 02E3: 6@ = car 5@ speed // ----------- [email protected] = speed output if and 4@ == 0 0AB0: key_pressed 71// G key START TIMER then 4@ = 1 end if 4@ == 1 then if or 6@ >= 45.0 // -------------------------- SPECIFIED SPEED TO STOP TIMER 0AB0: key_pressed 72// H key STOP TIMER then 018C: play_sound 1056 at 0.0 0.0 0.0 4@ = 2 end end if and 4@ == 2 0AB0: key_pressed 82// R key RESET TIMER then 0@ = 0 1@ = 0 33@ = 0 4@ = 0 end if 4@ == 0 then 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 250.0 'NUMBER' 00 // 045A: text_draw_1number 60.0 250.0 'NUMBER' 00 // 045A: text_draw_1number 100.0 250.0 'NUMBER' 0000 // 045A: text_draw_1number 100.0 280.0 'NUMBER' 0 // 045A: text_draw_1number 100.0 290.0 'NUMBER' 0 // end if 4@ == 1 then if 33@ >= 1000 then 0@ += 1 33@ = 0 end if 0@ >= 60 then 1@ += 1 0@ = 0 end 0085: 3@ = 33@ 0092: 7@ = float_to_integer 6@// convert speed output into integer 0085: 8@ = 6@ 8@ *= 1.2 // 2nd speed output by multiplicator 0092: 8@ = float_to_integer 8@// convert 2nd speed output into integer 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 250.0 'NUMBER' 1@ // minutes 045A: text_draw_1number 60.0 250.0 'NUMBER' 0@ // seconds 045A: text_draw_1number 100.0 250.0 'NUMBER' 33@ // milliseconds 045A: text_draw_1number 100.0 280.0 'NUMBER' 7@ // speed output 045A: text_draw_1number 100.0 290.0 'NUMBER' 8@ // 2nd speed output end if 4@ == 2 then 03F0: enable_text_draw 1 045A: text_draw_1number 30.0 250.0 'NUMBER' 1@ // minutes 045A: text_draw_1number 60.0 250.0 'NUMBER' 0@ // seconds 045A: text_draw_1number 100.0 250.0 'NUMBER' 3@ // milliseconds 045A: text_draw_1number 100.0 280.0 'NUMBER' 7@ // speed output 045A: text_draw_1number 100.0 290.0 'NUMBER' 8@ // 2nd speed output end end end end end CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Mysterdogg Posted October 1, 2018 Author Share Posted October 1, 2018 1 hour ago, ZAZ said: 6@ >= 45.0 I don't know if speed output is equal to km/h or miles/h or whatever So you can use the 2nd speed output and multiplicate it with your own multiplicator to display a real speed value in 3.row 1 Well, I've checked and tested the script a few times and it seems like it's a multiplier (apparently, an x4 factor), the default number, 45, equals to something close to 160 km/h in-game. I tried to set it as close to 100km/h (60 mp/h) as possible but it's still a bit ambiguous. But don't take me wrong, I'm really glad you're helping me with this. I just want a precise way to calculate the acceleration in order to corroborate my handling data edition. Link to comment Share on other sites More sharing options...
ZAZ Posted October 1, 2018 Share Posted October 1, 2018 use 2nd speed output to check for timestop [email protected] instead [email protected] but it must be integer in this case 8@ >= 100 Mysterdogg 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Mysterdogg Posted October 1, 2018 Author Share Posted October 1, 2018 Thanks, Zaz! it works better now but I will see if I can improve it in any way, hope you don't mind if I use the script as a base. Link to comment Share on other sites More sharing options...
ZAZ Posted October 2, 2018 Share Posted October 2, 2018 yes, there can be done much more, i'm too lazy for that Mysterdogg 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Junior_Djjr Posted October 3, 2018 Share Posted October 3, 2018 On 10/1/2018 at 3:12 PM, Mysterdogg said: Well, I've checked and tested the script a few times and it seems like it's a multiplier (apparently, an x4 factor), the default number, 45, equals to something close to 160 km/h in-game. I tried to set it as close to 100km/h (60 mp/h) as possible but it's still a bit ambiguous. But don't take me wrong, I'm really glad you're helping me with this. I just want a precise way to calculate the acceleration in order to corroborate my handling data edition. My test code from this video {$cleo} 0000: while true wait 0 00DF: actor $player_actor driving jf continue 0@ = actor.CurrentCar($player_actor) 0AB1: call_scm_func @getspeed 1 0@ -> 1@ 0AD1: show_formatted_text_highpriority "%3.f" time 2000 1@ end :getspeed 0A97: 1@ = car 0@ struct // get wheels rotation speed 0A8E: 14@ = 1@ + 0x848 0A8D: 21@ = read_memory 14@ size 4 virtual_protect 0 14@ += 0x4 0A8D: 22@ = read_memory 14@ size 4 virtual_protect 0 14@ += 0x4 0A8D: 23@ = read_memory 14@ size 4 virtual_protect 0 14@ += 0x4 0A8D: 24@ = read_memory 14@ size 4 virtual_protect 0 // mult by wheel size 0441: 12@ = car 0@ model 0AA7: call_function 0x00403DA0 num_params 1 pop 1 iId 12@ pclInfo 12@ //get CVehicleModelInfo 12@ += 0x40 0A8D: 15@ = read_memory 12@ size 4 virtual_protect 0 006B: 21@ *= 15@ 006B: 22@ *= 15@ 12@ += 0x4 0A8D: 15@ = read_memory 12@ size 4 virtual_protect 0 006B: 23@ *= 15@ 006B: 24@ *= 15@ 005B: 21@ += 22@ 005B: 21@ += 23@ 005B: 21@ += 24@ 21@ /= 4.0 21@ /= 2.45 // tweak based on distance 21@ *= -227.0 // fix km/h (???) 0AB2: ret 1 21@ The "problem" is that it's based on wheel rotation, but I think it will not interfere with your goal, just be careful with the low speeds, because when you accelerate abruptly the wheel turns very fast and will show a high speed (around 30 km/h, it vary) Mysterdogg 1 Link to comment Share on other sites More sharing options...
Junior_Djjr Posted October 3, 2018 Share Posted October 3, 2018 I added an easy way to get VehFuncs speed calculation: {$cleo} const pVehFuncs = [email protected] pGetVehicleSpeedRealistic = [email protected] hVeh = [email protected] pVeh = [email protected] fSpeed = [email protected] end if 0AA2: pVehFuncs = load_library "VehFuncs.asi" then 0AA4: pGetVehicleSpeedRealistic = get_proc_address "Ext_GetVehicleSpeedRealistic" library pVehFuncs 0AA3: free_library pVehFuncs end if not pGetVehicleSpeedRealistic > 0 then 0ACD: show_text_highpriority "~r~Fail to load 'VehFuncs.asi'" time 5000 0A93: end_custom_thread end while true wait 0 00DF: actor $player_actor driving jf continue hVeh = actor.CurrentCar($player_actor) 0A97: pVeh = car hVeh struct 0AA7: call_function_return pGetVehicleSpeedRealistic num_params 1 pop 1 pVeh -> fSpeed 0AD1: show_formatted_text_highpriority "Speed: ~y~%.3f" time 2000 fSpeed end You need this new version. Mysterdogg 1 Link to comment Share on other sites More sharing options...
Mysterdogg Posted October 3, 2018 Author Share Posted October 3, 2018 Spoiler 28 minutes ago, Junior_Djjr said: I added an easy way to get VehFuncs speed calculation: {$cleo} const pVehFuncs = [email protected] pGetVehicleSpeedRealistic = [email protected] hVeh = [email protected] pVeh = [email protected] fSpeed = [email protected] end if 0AA2: pVehFuncs = load_library "VehFuncs.asi" then 0AA4: pGetVehicleSpeedRealistic = get_proc_address "Ext_GetVehicleSpeedRealistic" library pVehFuncs 0AA3: free_library pVehFuncs end if not pGetVehicleSpeedRealistic > 0 then 0ACD: show_text_highpriority "~r~Fail to load 'VehFuncs.asi'" time 5000 0A93: end_custom_thread end while true wait 0 00DF: actor $player_actor driving jf continue hVeh = actor.CurrentCar($player_actor) 0A97: pVeh = car hVeh struct 0AA7: call_function_return pGetVehicleSpeedRealistic num_params 1 pop 1 pVeh -> fSpeed 0AD1: show_formatted_text_highpriority "Speed: ~y~%.3f" time 2000 fSpeed end You need this new version. I don't know if I'm doing something wrong but seems like the script doesn't work properly or don't even work. I've checked deleting the .asi file and the script didn't generate the error message in-game. Link to comment Share on other sites More sharing options...
Junior_Djjr Posted October 4, 2018 Share Posted October 4, 2018 18 hours ago, Mysterdogg said: Reveal hidden contents I don't know if I'm doing something wrong but seems like the script doesn't work properly or don't even work. I've checked deleting the .asi file and the script didn't generate the error message in-game. Impossible, the only explanation is that the script is not even active (see cleo.log) Link to comment Share on other sites More sharing options...
Mysterdogg Posted October 4, 2018 Author Share Posted October 4, 2018 8 hours ago, Junior_Djjr said: Impossible, the only explanation is that the script is not even active (see cleo.log) I've checked it every time I try to use it but, surprisedly, the script is loaded. I will see if I'm doing everything right but if I'm not wrong, the only thing I must do is to get in a car, right? that's what the script says unless I'm skipping a code line. 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