Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Prevent Deactivation
#1
Prevent Deactivation
by KK20
Version: 1.1
* and Minor F12 fix added by DerVVulfman



Introduction
When the game window is no longer the active window, it normally freezes the game from updating. This script will allow games to still run in the background.

This feature makes it so your game stays active and continues to run, even if you bring up another window or program.



Features
  • Keeps the game running, even if you're running another program
  • Has options to turn on/off the prevention feature
  • Versions for Ruby 1.8 and newer Ruby 2.0+



Script
The version for Ruby 1.8+
--or--
The version for Ruby 1.9.2+
--or--
The version for RPGMaker VXAce


Required Attachment

.zip   MessageIntercept.zip (Size: 27.17 KB / Downloads: 20)



Instructions
Mainly, place the .DLL attached in your project's root directory and paste the script just above main after all other custom scripts.  Other instructions are in the script.



FAQ
This was searched for by DerVVulfman, the request at RPGMakerWeb.Com posted and found right (>HERE<)



Compatibility
Designed for the RPGMaker engines, with two versions based on which version of Ruby/RGSS your engine is using.



Credits and Thanks
This script was designed by KK20, and with thanks to Jaiden for the toggle on/off feature request.


Terms and Conditions
Due credit for both KK20 and Jaiden is required.  Free for use in commercial projects.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply }
#2
It's weird to find no reason to double post the code here. Didn't you make any mistake, wulfo? O_o? Or has the original scripter lied to people hoping nobody would notice it?
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
Reply }
#3
I have done searches within the forum for key words of "KK20", "MessageIntercept", and "Deactivation". At no point do we have any thread or post that comes up. And as towards a search for the keyword of "Jaiden" who supplied a suggestion AND whom I've known for ten years since the old RMXP.Org days, no script posts were provided.

I have also performed a google searches for "MessageIntercept RPG" and "Deactivation RPG", so the returned list of viable links would only involve within RPGMaker forums for either the name 'Deactivation' or the MessageIntercept DLL file. No results were found.

If you are stating that this script already exists within this forum, please provide the link.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply }
#4
Hey DerVVulfman, it looks like you might have posted the Ruby 2.0 version twice in your original post, that might be what he means. Also, you can remove me (Jaiden) from the credits. I didn't contribute to the script--KK20 wrote it all. I just made a suggestion, so I don't want to be credited :P thank you though!
Reply }
#5
*ACK! I keep forgetting you go by that name in here!!!

And nope, that is not a double-post. There is a subtle difference between the two. Ruby 1.8 does not include the getbyte statement for the String class, so the 1.8 version contains the line:
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate[0] == 1
However, since the later versions of Ruby does have the getbyte statement, the newer version of the script instead contains the line:
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate.getbyte(0) == 1

This minor change was pointed out by KK20 as below:
KK20 at RPGMakerWeb Wrote:Oh right, forgot about that. You just use String#[] to get the byte. So it should be
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate[0] == 1
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply }
#6
(03-24-2019, 08:21 PM)DerVVulfman Wrote: *ACK!  I keep forgetting you go by that name in here!!!

And nope, that is not a double-post.  There is a subtle difference between the two.   Ruby 1.8 does not include the getbyte statement for the String class, so the 1.8 version contains the line:
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate[0] == 1
However, since the later versions of Ruby does have the getbyte statement, the newer version of the script instead contains the line:
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate.getbyte(0) == 1

This minor change was pointed out by KK20 as below:
KK20 at RPGMakerWeb Wrote:Oh right, forgot about that. You just use String#[] to get the byte. So it should be
Code:
update_if_game_in_focus if MessageIntercept::Flag_Deactivate[0] == 1

Ahh right, that makes sense.
Reply }
#7
The question would be if there's an actual need for two versions of the same script. I mean, isn't it enough to use either #[] or get_byte in both versions of Ruby. Who can confirm it? O_O
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
Reply }
#8
In regards of the two straight ruby versions, the second one utilizes a more current standard, the 'getbyte' function not previously available until Ruby 1.9.2. It is called keeping up with standards and practices, lest you would not be constantly upgrading HiddenChest with the latest version of Ruby. And who knows when a calling method becomes depreciated. You should appreciate that. Have you not found some RPGMaker XP scripts that worked with RPGMaker XP but not iwth your own HiddenChest? So in the spirit of keeping current, there are the two versions depending upon which version of Ruby is used.

Meanwhile, an "F12 Anti-Stack" fix was just added to the three scripts.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply }
#9
(03-25-2019, 07:26 PM)Thank you for this Wrote: Thanks for this script. I am noob to RPG Maker, let alone Ruby. But this script is exactly what I needed.

I had to change a bit so the game still accepts input while the window is inactive. Luckily, the instructions in the file was clear enough for me to understand and commented that part out.

I tried with SpecialK to do what I need, but it didn't hook at all. Thank you again for this.

EDIT 2: It works :) I had to start a new game. I guess the old save file still uses the old script system somehow.


For those who is curious, I edited this part out so the game would still accept player input while the window is inactive (for controller)


Code:
 # Only accept player input if the game window is in focus
 #  def self.update
 #  update_if_game_in_focus if MessageIntercept::Flag_Deactivate.getbyte(0) == 1
 # end
Reply }




Users browsing this thread: