Difference between revisions of "Real Time Clock"

From GTAMods Wiki
Jump to navigation Jump to search
(Installation)
(syntax highlighting, merged explanation with code)
Line 3: Line 3:
 
This installation guide uses the latest version of the [[Sanny Builder]].
 
This installation guide uses the latest version of the [[Sanny Builder]].
  
Find
+
Find:
004F: create_thread @MS_BIKE_MISSIONS
+
<source lang="scm">004F: create_thread @MS_BIKE_MISSIONS</source>
  
Add below
+
and add below:
004F: create_thread @RTMOD
+
<source lang="scm">004F: create_thread @RTMOD</source>
  
Find
+
Find:
//-------------Mission 0---------------
+
<source lang="scm">//-------------Mission 0---------------</source>
  
Add above
+
and add above:
:RTMOD
+
<source lang="scm">:RTMOD
03A4: name_thread 'RTMOD'
+
03A4: name_thread 'RTMOD' // This is the name of the thread.
 
   
 
   
:RTMOD_11
+
:RTMOD_11
0001: wait 0 ms
+
0001: wait 0 ms // The code is in loop so you need a wait here to prevent a crash.
00BF: 0@ = current_time_hours, 1@ = current_time_minutes
+
00BF: 0@ = current_time_hours, 1@ = current_time_minutes // This stores the game's current time in hours as 0@ and in minutes as 1@.
00C0: set_current_time_hours_to 0@ minutes_to 1@
+
00C0: set_current_time_hours_to 0@ minutes_to 1@ // This forces the time to stay still.
01B6: set_weather 0
+
01B6: set_weather 0 // Because of the manipulation of time in loop, the weather would change constantly. This prevents the weather from doing that.
00D6: if
+
00D6: if
0019:  32@ > 59999
+
0019:  32@ > 59999 // Checks if 59999 milliseconds has passed (1 minute).
004D: jump_if_false @RTMOD_11
+
004D: jump_if_false @RTMOD_11 // If not, loop back up. If yes, continue.
0006: 32@ = 0
+
0006: 32@ = 0 // Internal timer 32@ is reset so it can check if one minute has passed again later on.
000A: 1@ += 1
+
000A: 1@ += 1 // One game minute is added.
00D6: if
+
00D6: if
0019:  1@ > 59
+
0019:  1@ > 59 // Checks if time in minutes passed 59 minutes.
004D: jump_if_false @RTMOD_128
+
004D: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.
0006: 1@ = 0
+
0006: 1@ = 0 // Resets the minute.
000A: 0@ += 1
+
000A: 0@ += 1 // One game hour is added because 59 minutes has passed.
00D6: if
+
00D6: if
0019:  0@ > 23
+
0019:  0@ > 23 // Checks if time in hours passed 23 hours.
004D: jump_if_false @RTMOD_128
+
004D: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.
0006: 0@ = 0
+
0006: 0@ = 0 // Resets the hour.
 
:RTMOD_128
 
00C0: set_current_time_hours_to 0@ minutes_to 1@
 
0002: jump @RTMOD_11
 
 
 
==Explanation==
 
:RTMOD
 
[[03A4]]: name_thread 'RTMOD' // This is the name of the thread.<br>
 
 
 
:RTMOD_11
 
[[0001]]: wait 0 ms // The code is in loop so you need a wait here to prevent a crash.<br>
 
[[00BF]]: 0@ = current_time_hours, 1@ = current_time_minutes // This stores the game's current time in hours as 0@ and in minutes as 1@.<br>
 
[[00C0]]: set_current_time_hours_to 0@ minutes_to 1@ // This forces the time to stay still.<br>
 
[[01B6]]: set_weather 0 // Because of the manipulation of time in loop, the weather would change constantly. This prevents the weather from doing that.<br>
 
[[00D6]]: if // one condition<br>
 
[[0019]]:  32@ > 59999 // Checks if 59999 milliseconds has passed (1 minute).<br>
 
[[004D]]: jump_if_false @RTMOD_11 // If not, loop back up. If yes, continue.<br>
 
[[0006]]: 32@ = 0 // Internal timer 32@ is reset so it can check if one minute has passed again later on.<br>
 
[[000A]]: 1@ += 1 // One game minute is added.<br>
 
[[00D6]]: if // one condition<br>
 
[[0019]]:  1@ > 59 // Checks if time in minutes passed 59 minutes.<br>
 
[[004D]]: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.<br>
 
[[0006]]: 1@ = 0 // Resets the minute.<br>
 
[[000A]]: 0@ += 1 // One game hour is added because 59 minutes has passed.<br>
 
[[00D6]]: if // one condition<br>
 
[[0019]]:  0@ > 23 // Checks if time in hours passed 23 hours.<br>
 
[[004D]]: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.<br>
 
[[0006]]: 0@ = 0 // Resets the hour.<br>
 
  
:RTMOD_128
+
:RTMOD_128
[[00C0]]: set_current_time_hours_to 0@ minutes_to 1@ // Game time is forced to set at those values.<br>
+
00C0: set_current_time_hours_to 0@ minutes_to 1@ // Game time is forced to set at those values.
[[0002]]: jump @RTMOD_11 // Loops back up.<br>
+
0002: jump @RTMOD_11 // Loops back up.</source>
  
 
==Information==
 
==Information==
Author: Barton Waterduck<br>
+
Author: [[Barton Waterduck]]<br>
Game: Vice City, San Andreas
+
Games: [[GTA VC]], [[GTA SA]]
  
 
[[Category:Code Snippets]][[Category:GTA VC]][[Category:GTA SA]]
 
[[Category:Code Snippets]][[Category:GTA VC]][[Category:GTA SA]]

Revision as of 18:21, 2 February 2009

This code snippet is a modification that attempts to make one game minute equal to one real minute.

Installation

This installation guide uses the latest version of the Sanny Builder.

Find:

004F: create_thread @MS_BIKE_MISSIONS

and add below:

004F: create_thread @RTMOD

Find:

//-------------Mission 0---------------

and add above:

:RTMOD
03A4: name_thread 'RTMOD' // This is the name of the thread.
 
:RTMOD_11
0001: wait 0 ms // The code is in loop so you need a wait here to prevent a crash.
00BF: 0@ = current_time_hours, 1@ = current_time_minutes // This stores the game's current time in hours as 0@ and in minutes as 1@.
00C0: set_current_time_hours_to 0@ minutes_to 1@ // This forces the time to stay still.
01B6: set_weather 0 // Because of the manipulation of time in loop, the weather would change constantly. This prevents the weather from doing that.
00D6: if
0019:   32@ > 59999 // Checks if 59999 milliseconds has passed (1 minute).
004D: jump_if_false @RTMOD_11 // If not, loop back up. If yes, continue.
0006: 32@ = 0 // Internal timer 32@ is reset so it can check if one minute has passed again later on.
000A: 1@ += 1 // One game minute is added.
00D6: if
0019:   1@ > 59 // Checks if time in minutes passed 59 minutes.
004D: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.
0006: 1@ = 0 // Resets the minute.
000A: 0@ += 1 // One game hour is added because 59 minutes has passed.
00D6: if
0019:   0@ > 23 // Checks if time in hours passed 23 hours.
004D: jump_if_false @RTMOD_128 // If not, jump to next label. If yes, continue.
0006: 0@ = 0 // Resets the hour.

:RTMOD_128
00C0: set_current_time_hours_to 0@ minutes_to 1@ // Game time is forced to set at those values.
0002: jump @RTMOD_11 // Loops back up.

Information

Author: Barton Waterduck
Games: GTA VC, GTA SA