Save-Point
Centi-Second Wait Count - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Centi-Second Wait Count (/thread-7542.html)



Centi-Second Wait Count - DerVVulfman - 09-12-2019

Centi-Second Wait Count
Version: 1.5



Definition
Centi-Second: Noun. (plural centiseconds)
1) A unit of time equal to 0.01 seconds and with symbol cs.
2) Time of 91 926 317.7 periods of the radiation corresponding to the transition between the 2 hyperfine levels of the ground state of the caesium 133 atom at 0 K .



Introduction
This script grants one the ability to use an alternate system to the default wait system. Unlike the default wait system, this one uses the actual system clock to measure time in centi-seconds, or down to a hundredth of a second. And since it does not rely on the graphics framecount system which can be slowed down, it is more accurate.

The only drawback is that major rewrites had to be performed within three classes to add this feature; the actual timing system needing to be placed within loop-end blocks of code.

However, it also allows the map event PICTURE system to be controlled by the meticulous system of centi-seconds, so timing will be exact regardless of PC or Smooth-mode/Normal-mode settings are used.



Features
  • Field Map Script Call for new wait counter down to 1/100th of a second.
  • Script Call in Custom Move Routes allows for new wait counter down to 1/100th of a second.
  • Troop Database Script Call for new wait counter down to 1/100th of a second.
  • Picture movement and Picture tone manipulation down to 1/100th of a second.
  • Special timer system based on duration from event start for field maps



Screenshots
Are you kidding? This is a timer system.



Demo
CLICK ME
* It's pretty simplistic
* If studying, look for dashed lines within the code to show the direct edits to the update and move_type_custom methods.



Instructions
Generally, paste after Scene_Debug and before main in your script database. Due to heavy rewrites in three principle methods, it is recommended to be the first script within your list of custom scripts below Scene_Debug.

It does not replace the [Wait] button in the list of event commands. You use a script call of: set_cs_wait(value) where value is the number of centi-seconds for a delay.



Recommendation
Would be excellent for use with cutscenes. Recommend using with the Prevent Window Deactivation (aka MessageIntercept) system by KK20.



Compatibility
* NOT based on the RPGMaker RMXP SDK system.
Designed for RPGMaker XP, though the premise and edits shown should be valid for other Enterbrain engines using Ruby. It overwrites update methods in the Interpreter, Game_Character and Scene_Battle code, so it should be the first script in your list of custom scripts. That is, unless you perform direct edits yourself.



Author's Notes
Considered Intermediate to Skilled/Advanced due to method rewrites.


RE: Centi-Second Wait Count - DerVVulfman - 09-14-2019

BUMP
to version 1.1

With the addition of two small methods and an instance variable, it can now work to track when event commands need to pause in a new manner.

For those not familiar with how to use the script in map events....

Code:
@>Script: set_cs_wait(1000)
@>Play SE: "014-Move02", 80, 100
@>Script: set_cs_wait(250)
@>Play SE: "014-Move02", 80, 100
This is a normal one using the set_cs_wait command in place of the default wait command.


And now... the NEW feature:
Code:
@>Script: set_cs_start
@>Play BGM: "018-Field01", 80, 100
@>Show Picture 1, "Splash-1", Upper Left (0,0), (100%,100%), 0, Normal
@>Script: cs_wait_full(200)
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),255, Normal
@>Script: cs_wait_full(950)
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),0, Normal
@>Script: cs_wait_full(1300)
@>Show Picture 1, "Splash-2", Upper Left (0,0), (100%,100%), 0, Normal
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),255, Normal
@>Script: cs_wait_full(2000)
Okay, I was having fun making splash screens after starting the music.  Note that this one uses the set_cs_start command before anything happens, and the cs_wait_full statements all have increasing values attached, each measuring when the events run based on 1/100th of a second.  IE:  cs_wait_full(1300) makes the event wait until 13 seconds have passed since the set_cs_start command had run.


RE: Centi-Second Wait Count - DerVVulfman - 10-07-2019

BUMP
to version 1.2

Overlooked until now was an issue where one leaves the field map and enters either a menu or deals with a saved game. For the normal Wait system, it merely dealt with a recorded framecount. With the Centi-Second system, timing works differently as it relies on your PC's own clock.

Now while this doesn't matter much if using the wait option as you would the normal wait count, but this can mess up the wait system in a 'custom move route' option. If such an event is currently waiting for a long time and exits to a menu and then returns back to the map, the delay may be over immediately. That is, until this new version which fixes this issue with the application of an adaptive timestamp option.


RE: Centi-Second Wait Count - DerVVulfman - 08-27-2020

BUMP
to version 1.3

Now you can have meticulous centi-second timing control over the pictures when using [Move Picture] and [Change Picture Tone] map events!

This new update does rewrite the 'update' method in Game_Pictures, but doing so allows much finer manipulation of the pictures displayed in the game.

For those not familiar with how to use the script in map events....
Code:
@>Show Picture 1, "Splash-1", Upper Left (0,0), (100%,100%), 0, Normal
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),255, Normal
This is a how one could make a picture go from 0 opacity to 255 opacity, using the default 'frames' system. It would go from being invisible to fully solid in 20 frames.

ONE optional change
Code:
@>Show Picture 1, "Splash-1", Upper Left (0,0), (100%,100%), 0, Normal
@>Script: picture_cs_wait
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),255, Normal
Again, this makes the picture go from 0 opacity to 255 opacity. But the new 'picture_cs_wait' command tells the system that the duration of '20' in the move picture command is now 20 centi-seconds. The timing you set in the Move Picture command is converted into centi-seconds... and 20 centi-seconds is PRETTY DAMN FAST!


ANOTHER optional change
Code:
@>Show Picture 1, "Splash-1", Upper Left (0,0), (100%,100%), 0, Normal
@>Script: picture_cs_wait 200
@>Move Picture 1, @20, Upper Left (0,0), (100%,100%),255, Normal
This time, we are establishing in the new 'picture_cs_wait' command a centi-second delay of 200 centi-seconds (or 2 seconds). This overrides the timing set in the Move Picture command itself! So if you wanted to have a picture move over a duration of 10 seconds or longer (1000+ centi-seconds), this option within the 'picture_cs_wait' command is certainly desirable.

NOW ... for TONES
Code:
@>Show Picture 1, "Splash-1", Upper Left (0,0), (100%,100%), 255, Normal
@>Script: picture_cs_wait 200
@>Change Picture Color Tone 1, (255,0,0,0) @5
This is not unlike the others, except we are using the 'picture_cs_wait' command to change the tone of a picture over an expanse of 200 centi-seconds, and not 5 frames as the Color Tone command suggests.


All this should really assist in crafting meticulous cut scenes that will play accurately regardless of the speed of your audience's PC.


RE: Centi-Second Wait Count - DerVVulfman - 08-27-2020

BUMP
to version 1.4

DOH! I overlooked some of the basic mechanics.

For proper centi-second movement, the placement of the pictures relied upon a percentage-gauge system.  This didn't fully translate well when the picture needed to go from point A to point B.  Sure it moved, but it started as a crawl at the start and then zoomed to the destination like Barry Allen.

It wasn't so apparent with short delays, but slow pans with larger images revealed this flaw.  However, this flaw had been fixed for all related centi-second picture features.


RE: Centi-Second Wait Count - DerVVulfman - 09-12-2020

BUMP
to version 1.5

A necessary fix was just added to the system, one that fixed a crucial and critical bug which could occur if a centi-second wait was interrupted incorrectly. It was a small thing, so it shouldn't interfere with any commands already in place of your projects.