Dragon King Posted October 9, 2009 Posted October 9, 2009 Why am I getting attacked by the cops each time I want to set my time circuits? Quote
Mike Posted October 9, 2009 Posted October 9, 2009 Why am I getting attacked by the cops each time I want to set my time circuits? They don't like dragons, or kings of dragons Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 They don't like dragons, or kings of dragons Stupid cops Don't they know it ain't nice to mess with dragons? Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 The cops think you're in a very suspicious looking car. Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 Blue I'm trying your create_custom_thread_named 'blah' but when I create the new thread and compile it gets rid of the thread name. here's what it's doing: uncompiled: :CLOCK_354 00BF: 3@ = current_time_hours, 4@ = current_time_minutes 00D6: if 0038: $TIME_CHANGE == 1 004D: jump_if_false @CLOCK_397 0004: $TIME_CHANGE = 0 0A92: create_custom_thread "SOUND" :CLOCK_397 008D: 3@ = integer 3@ to_float 008D: 4@ = integer 4@ to_float 0013: 3@ *= 30.0 0013: 4@ *= 6.0 0017: 4@ /= 12.0 005B: 3@ += 4@ // (float) 0013: 4@ *= 12.0 0453: set_object $HOURHAND XY_rotation 3@ 0.0 angle 0.0 0453: set_object $MINUTEHAND XY_rotation 4@ 0.0 angle 0.0 0004: $TIME_CHANGE = 1 0002: jump @CLOCK_354 :sound 03A4: name_thread 'SOUND' 0006: 16@ = 0 0050: gosub @SOUND_480 00BF: 0@ = current_time_hours, 1@ = current_time_minutes 00D6: if 0039: 1@ == 0 004D: jump_if_false @SOUND_58 0002: jump @SOUND_196 Compiled: :CLOCK_354 00BF: 3@ = current_time_hours, 4@ = current_time_minutes 00D6: if 0038: $TIME_CHANGE == 1 004D: jump_if_false @CLOCK_397 0004: $TIME_CHANGE = 0 0A92: create_custom_thread "SOUND" :CLOCK_397 008D: 3@ = integer 3@ to_float 008D: 4@ = integer 4@ to_float 0013: 3@ *= 30.0 0013: 4@ *= 6.0 0017: 4@ /= 12.0 005B: 3@ += 4@ // (float) 0013: 4@ *= 12.0 0453: set_object $HOURHAND XY_rotation 3@ 0.0 angle 0.0 0453: set_object $MINUTEHAND XY_rotation 4@ 0.0 angle 0.0 0004: $TIME_CHANGE = 1 0002: jump @CLOCK_354 03A4: name_thread 'SOUND' 0006: 16@ = 0 0050: gosub @SOUND_480 00BF: 0@ = current_time_hours, 1@ = current_time_minutes 00D6: if 0039: 1@ == 0 004D: jump_if_false @SOUND_58 0002: jump @SOUND_196 Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 the thread is the name of the file, not label in the same file. I thought "thread.s" would tip you off to that fact. Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 Is the return function usable in a custom thread? Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 well the code freezes my game. I'm using the return function to go back to the cs file bu then I tried the end_custom_thread and it still freezes. Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 in that case, return doesn't work. I only said depends if you used a gosub in the new thread. The thread just gets created so you have an extra thread running while the original keeps on going. If you want to have it return functions, I suggest using 0AB1 and 0AB2. Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 well no matter what I do it isn't working. The game just freezes before it is loaded completely. I know the code works when I gosub it but it won't work correctly if I do. Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 it should if you know how to do it. Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 I'll just wait till you get to that point Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 wait, this is SA, right? You can't use $ variables. They conflict with the scm globals. You are only allowed to use @. Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 still freezes I'm going to post what I have: Clock.cs: 03A4: name_thread 'CLOCK' 029B: 10@ = init_object 18697 at 304.348 2563.7 103.656 0382: set_object 10@ collision_detection 0 0392: make_object 10@ moveable 0 01C7: remove_object_from_mission_cleanup_list 10@ 029B: 9@ = init_object 18698 at 304.318 2563.7 103.656 0382: set_object 9@ collision_detection 0 0392: make_object 9@ moveable 0 01C7: remove_object_from_mission_cleanup_list 9@ 029B: 8@ = init_object 18694 at 304.663 2563.7 103.656 01C7: remove_object_from_mission_cleanup_list 8@ 029B: 1@ = init_object 18695 at 304.663 2563.7 103.656 01C7: remove_object_from_mission_cleanup_list 1@ 029B: 2@ = init_object 18690 at 304.547 2563.7 106.652 01C7: remove_object_from_mission_cleanup_list 2@ :CLOCK_354 00BF: 3@ = current_time_hours, 4@ = current_time_minutes 00D6: if 0038: 7@ == 1 004D: jump_if_false @CLOCK_397 0004: 7@ = 0 0A92: create_custom_thread "CLOCKSOUND.S" :CLOCK_397 008D: 3@ = integer 3@ to_float 008D: 4@ = integer 4@ to_float 0013: 3@ *= 30.0 0013: 4@ *= 6.0 0017: 4@ /= 12.0 005B: 3@ += 4@ // (float) 0013: 4@ *= 12.0 0453: set_object 10@ XY_rotation 3@ 0.0 angle 0.0 0453: set_object 9@ XY_rotation 4@ 0.0 angle 0.0 0004: 7@ = 1 0002: jump @CLOCK_354 Clocksound.S //-------------MAIN--------------- 0AAC: 20@ = load_mp3 "CLEO\AUDIO\DONG.MP3" 0AAC: 21@ = load_mp3 "CLEO\AUDIO\HOURLY_CHIME.MP3" 0AAC: 22@ = load_mp3 "CLEO\AUDIO\QUARTER_AFTER_CHIME.MP3" 0AAC: 23@ = load_mp3 "CLEO\AUDIO\HALF_PAST_CHIME.MP3" 0AAC: 24@ = load_mp3 "CLEO\AUDIO\QUARTER_2_CHIME.MP3" 0006: 16@ = 0 0050: gosub @clocksound_480 00BF: 0@ = current_time_hours, 1@ = current_time_minutes 00D6: if 0039: 1@ == 0 004D: jump_if_false @clocksound_58 0002: jump @clocksound_196 :clocksound_58 00D6: if 0039: 1@ == 15 004D: jump_if_false @clocksound_104 0AAD: set_mp3 22@ perform_action 0 0AAD: set_mp3 22@ perform_action 1 0050: gosub @clocksound_375 0002: jump @clocksound_318 :clocksound_104 00D6: if 0039: 1@ == 30 004D: jump_if_false @clocksound_150 0AAD: set_mp3 23@ perform_action 0 0AAD: set_mp3 23@ perform_action 1 0050: gosub @clocksound_375 0002: jump @clocksound_318 :clocksound_150 00D6: if 0039: 1@ == 45 004D: jump_if_false @clocksound_318 0AAD: set_mp3 24@ perform_action 0 0AAD: set_mp3 24@ perform_action 1 0050: gosub @clocksound_375 0002: jump @clocksound_318 :clocksound_196 00D6: if 0039: 0@ == 0 004D: jump_if_false @clocksound_228 0006: 0@ = 12 0002: jump @clocksound_253 :clocksound_228 00D6: if 0019: 0@ > 12 004D: jump_if_false @clocksound_253 000E: 0@ -= 12 :clocksound_253 00D6: if and 0019: 0@ > 0 0004: 6@ = 0 004D: jump_if_false @clocksound_318 000E: 0@ -= 1 0AAD: set_mp3 21@ perform_action 0 0AAD: set_mp3 21@ perform_action 1 0050: gosub @clocksound_320 0001: wait 1000 ms 0002: jump @clocksound_253 :clocksound_318 0A93: end_custom_thread :clocksound_320 0006: 16@ = 0 :clocksound_327 0001: wait 10 ms 00D6: if 8029: not 16@ >= 3000 004D: jump_if_false @clocksound_478 00D6: if 0038: 6@ == 0 004D: jump_if_false @clocksound_318 0002: jump @clocksound_327 :clocksound_375 0006: 16@ = 0 :clocksound_382 0001: wait 10 ms 00D6: if 8029: not 16@ >= 15000 004D: jump_if_false @clocksound_478 00D6: if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere 300.5628 2563.654 88.85578 radius 85.0 85.0 85.0 004D: jump_if_false @clocksound_318 00D6: if 0038: 6@ == 0 004D: jump_if_false @clocksound_318 0002: jump @clocksound_382 :clocksound_478 0A93: end_custom_thread :clocksound_480 0001: wait 0 ms 00D6: if 8029: not 16@ >= 15000 004D: jump_if_false @clocksound_318 00D6: if 00FE: actor $PLAYER_ACTOR sphere 0 in_sphere 300.5628 2563.654 88.85578 radius 85.0 85.0 85.0 004D: jump_if_false @clocksound_480 0051: return Quote
Mini-Me Posted October 9, 2009 Posted October 9, 2009 wait, this is SA, right? You'd better ask if it's Cleo . @DK: As bluespace88 said, you can't use most global variables in Cleo threads, only a few like $Player_Char, $Player_Actor, $OnMission are allowed. So you can only use locals (the @ ones) and special variables that are available in all Cleo threads: 0ab3 to save something in the var and 0ab4 to read it. If you e.g. want to create an object in these vars you need to create it in a local first and then in the Cleo-wide: Object.Create(0@, #Hourhand, 1@, 2@, 3@) 0ab3: var 0 = 0@ //or since SB is flexible :p 0@ = Object.Create(#Minutehand, 1@, 2@, 3@) 0ab3: var 1 = 0@ Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 ok and what if it still doesn't work? It did before I created the custom thread Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 jeeze, same problem again with your other code you showed me. Add a wait statement after :clock_354. btw, he doesn't need to use shared variables since the objects aren't referenced in the clock sounds thread. And I recommend not using a seperate thread. Just use gosubs. Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 you know what, that code I made sucks. Quote
bluespace88 Posted October 9, 2009 Author Posted October 9, 2009 I much prefer this 03A4: name_thread 'CLOCK' 029B: 10@ = init_object 18697 at 304.348 2563.7 103.656 0382: set_object 10@ collision_detection 0 0392: make_object 10@ moveable 0 01C7: remove_object_from_mission_cleanup_list 10@ 029B: 9@ = init_object 18698 at 304.318 2563.7 103.656 0382: set_object 9@ collision_detection 0 0392: make_object 9@ moveable 0 01C7: remove_object_from_mission_cleanup_list 9@ 029B: 8@ = init_object 18694 at 304.663 2563.7 103.656 01C7: remove_object_from_mission_cleanup_list 8@ 029B: 1@ = init_object 18695 at 304.663 2563.7 103.656 01C7: remove_object_from_mission_cleanup_list 1@ 029B: 2@ = init_object 18690 at 304.547 2563.7 106.652 01C7: remove_object_from_mission_cleanup_list 2@ 0AAC: 20@ = load_mp3 "CLEO\AUDIO\DONG.MP3" 0AAC: 21@ = load_mp3 "CLEO\AUDIO\HOURLY_CHIME.MP3" 0AAC: 22@ = load_mp3 "CLEO\AUDIO\QUARTER_AFTER_CHIME.MP3" 0AAC: 23@ = load_mp3 "CLEO\AUDIO\HALF_PAST_CHIME.MP3" 0AAC: 24@ = load_mp3 "CLEO\AUDIO\QUARTER_2_CHIME.MP3" 5@ = -1 6@ = -1 :Clock wait 100 00BF: 3@ = current_time_hours, 4@ = current_time_minutes 008D: 3@ = integer 3@ to_float 008D: 4@ = integer 4@ to_float 0013: 3@ *= 30.0 0013: 4@ *= 6.0 0017: 4@ /= 12.0 005B: 3@ += 4@ // (float) 0013: 4@ *= 12.0 0453: set_object 10@ XY_rotation 3@ 0.0 angle 0.0 0453: set_object 9@ XY_rotation 4@ 0.0 angle 0.0 if or 803B: not 3@ == 5@ // (int) 803B: not 4@ == 6@ // (int) jf @Clock 0085: 5@ = 3@ // (int) 0085: 6@ = 4@ // (int) if 4@ == 0 jf @ClockQuarterAfter if 3@ > 12 then 3@ -= 12 end 0AAD: set_mp3 21@ perform_action 0 0AAD: set_mp3 21@ perform_action 1 0AB9: get_mp3 21@ state_to 15@ while not 15@ == -1 wait 0 0AB9: get_mp3 21@ state_to 15@ end wait 1000 for 15@ = 0 to 3@ step 1 0AAD: set_mp3 20@ perform_action 0 0AAD: set_mp3 20@ perform_action 1 wait 3000 end jump @Clock :ClockQuarterAfter if 4@ == 15 jf @ClockHalf 0AAD: set_mp3 22@ perform_action 0 0AAD: set_mp3 22@ perform_action 1 jump @Clock :ClockHalf if 4@ == 30 jf @c**kQuarterBefore 0AAD: set_mp3 23@ perform_action 0 0AAD: set_mp3 23@ perform_action 1 jump @Clock :ClockQuarterBefore if 4@ == 45 jf @Clock 0AAD: set_mp3 24@ perform_action 0 0AAD: set_mp3 24@ perform_action 1 jump @Clock Quote
Dragon King Posted October 9, 2009 Posted October 9, 2009 yeah I added the wait and it still doesn't load. The only way it loads is if I comment out the create_custom_thread oh ok I'll try that Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.