RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Fullscreen Choice

0 Members and 1 Guest are viewing this topic.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Oh no, I made another script!
Fullscreen Choices
Version: 2.1a
Author: Welfare-Daddy Pacman
Date: 20/4/2011

Version History


  • <Version 1.0> 11.04.2011 - Original Release
  • <Version 2.0> 19.04.2011 - Revamped script: added more customization, fixed layout and moved main processing out of class declaration.
  • <Version 2.0a> 19.04.2011 - Script works now. Doi.
  • <Version 2.1> 19.04.2011 - Got rid of the scene in the battle test.
  • <Version 2.1a> 20.04.2011 - Made script more efficient by making it inherit from Scene_Title instead of Scene_Base, allowing the battle test to run smoother.

Planned Future Versions

  • Version 2.5 - Putting music into the choice scene.

Description


This script is a rewrite of Main. Do not put it in Materials. Replace Main with this script. This script simply puts a choice of playing windowed or full-screened or simply quitting the game before the title screen shows.

Features

  • Just read the script.

Screenshots

Hardly necessary.

Instructions

Follow the instructions in the script to the letter.

Script


Spoiler for Code:
Code: [Select]
=begin
================================================================================
Author: Welfare-Daddy Pacman (rmrk.net)
Based from Mr. Wiggles
Version 2.0
Last update: 19/4/2011

Description:
This script simply puts a choice of playing windowed or full-screened or
simply quitting the game before the title screen shows.
Instructions:
  -Replace Main with this script. Plug-and-play, unless you want to configure
  some stuff.
  -Configuration begins at line 17 and ends at line 35.
================================================================================
=end
#-------------------------------------------------------------------------------
# BEGIN EDITING SECTION
#-------------------------------------------------------------------------------

SKIP_TOGGLE = false # This will skip the toggle if you have a save slot.
COMMAND_OPACITY = 160 # Change this value to the opacity you want.
INPUT_KEY = Input::C # This is the key used to confirm the command prompt.
QUIT_KEY = Input::B # This is the key used to quit the command prompt.
SCENE = Scene_Title.new # The scene that is after or before Scene_Screenchoice.
FULLSCREENTEXT = "Full-screen" # The text displayed on the full-screen option.
WINDOWEDTEXT = "Windowed" # The text displayed on the windowed option.
QUITTEXT = "Quit" # The text displayed on the quit option.
WINDOWX = 272 # The x placement of the command window.
WINDOWY = 208 # The y placement of the command window.
WINDOWWIDTH = 192 # The width of the window. Alter this to accommodate
 # for large option texts.
 
#-------------------------------------------------------------------------------
# END EDITING SECTION A
#-------------------------------------------------------------------------------
# Start Scene_Screenchoice
#-------------------------------------------------------------------------------

class Scene_Screenchoice < Scene_Title
  def main
    if $BTEST # If battle test
      battle_test # Run battle test
    else
      @title = Scene_Title.new
      @title.load_database
      s1 = FULLSCREENTEXT # Check FULLSCREENTEXT
      s2 = WINDOWEDTEXT # Check WINDOWEDTEXT
      s3 = QUITTEXT # Check QUITTEXT
      @command_window = Window_Command.new(WINDOWWIDTH, [s1, s2, s3]) # Create
      @command_window.opacity = COMMAND_OPACITY # Check opacity
      @command_window.x = WINDOWX - @command_window.width / 2 # Check X
      @command_window.y = WINDOWY - @command_window.height / 2 # Check Y
      Graphics.transition # Transition
      loop do # Loop
        Graphics.update # Update graphics
        Input.update # Update input
        update # Duh.
        if $scene != self # If scene isn't self
          break # Stop updating
        end
      end
      Graphics.freeze # Freeze Graphics
      @command_window.dispose # Dispose command window
    end
  end
 
#-------------------------------------------------------------------------------
# Update
#-------------------------------------------------------------------------------

  def update
    @command_window.update
    if Input.trigger?(INPUT_KEY)
      case @command_window.index
      when 0
        Sound.play_decision
        unless $keybd
          call_fullscreen
        end
        call_scene_title
      when 1
        Sound.play_decision
        call_scene_title
      when 2
        close_window
      end
    end
    if Input.trigger?(QUIT_KEY)
      close_window
    end
  end

#-------------------------------------------------------------------------------
# Call Scene_Title
#-------------------------------------------------------------------------------

  def call_scene_title
    $scene = Scene_Title.new
  end

#-------------------------------------------------------------------------------
# Call Fullscreen
#-------------------------------------------------------------------------------
 
  def call_fullscreen
    $keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
    $keybd.call 0xA4, 0, 0, 0
    $keybd.call 13, 0, 0, 0
    $keybd.call 13, 0, 2, 0
    $keybd.call 0xA4, 0, 2, 0
  end
   
#-------------------------------------------------------------------------------
# Close Window
#-------------------------------------------------------------------------------

  def close_window
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = nil
  end
end

#-------------------------------------------------------------------------------
# Main Processing
#-------------------------------------------------------------------------------

begin
  Graphics.freeze
  if SKIP_TOGGLE and (Dir.glob('Save*.rvdata').size > 0)
    $scene = SCENE
  else
    $scene = Scene_Screenchoice.new
  end
  while $scene != nil
    $scene.main
  end
  Graphics.transition(20)
rescue Errno::ENOENT
  filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
end

#-------------------------------------------------------------------------------
# END
#-------------------------------------------------------------------------------

Credit


  • Welfare-Daddy Pacman
  • Mr. Wiggles

Thanks

  • Mr. Wiggles for the original script.
  • Modern Algebra for his help with scripting (and being awesome).
  • LoganForrests for the same reason. :P
  • Zeriab for improving suggestions.

Support


I'm on RMRK a lot. Just post here or PM me.

Known Compatibility Issues

Will probably not work with debug scripts that refer to main.

Demo


Not applicable.

Author's Notes


Free for use in commercial and non-commercial games with credit. If you are using it in a commercial game, let me know.

Restrictions

Eh. Don't take credit for mine or Mr. Wiggles work.
 :ccbysa: :rmvx:
For indie games.  :nespad:
« Last Edit: April 20, 2011, 05:15:25 AM by Welfare-Daddy Pacman »
it's like a metaphor or something i don't know

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
I have three suggestions:
  • Include the load_database method in Scene_Title
  • Move the main loop out of the class declaration
  • Fix up the indention

*hugs*

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Yeah, I probably should've paid more attention to that stuff. However, I'm working on another script at the moment, and I'm a little swamped with other stuff. Also, I have a tingly feeling in my heart because you posted here. I feel special.
How could I forget to include the load_database method? Doi. Not quite sure what that second one means though...
Thanks for the suggestions!

EDIT: Don't really see the point of load_database in the script if it is made in Scene_Title, but I'll do it anyway.
« Last Edit: April 12, 2011, 11:00:33 AM by Welfare-Daddy Pacman »
it's like a metaphor or something i don't know

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Oh, nvm about the load_database method. I thought you wrote an rmxp script as Scene_ScreenChoice doesn't inherit from Scene_Base.

Your improper indentions does sorta hide my second bullet point.
Anyway your class is structured a bit like this:
Code: [Select]
class Scene_ScreenChoice < Scene_Base
  # ...
  begin
    # main  loop
  end
end

I suggest moving the main loop out of the class declaration. I.e.
Code: [Select]
class Scene_ScreenChoice < Scene_Base
  # ...
end

begin
  # main  loop
end

*hugs*

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Alrighty, I'll give that a shot.
At the moment, however, I'm working on putting music into the scene. I've never dealt with operating BGMs in script before, only terminating them. As a result, I don't know how to do it and I can't recall any scripts I could 'study' to get the function from.
Another thing I'm doing is to get rid of the window before battle tests, as it's just annoying. That shouldn't be difficult at all though.
I'll fix my indentation for you though (do you mean to put it all as far left as possible or that there's something wrong with the way it's put out?)
it's like a metaphor or something i don't know

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Major update!
Done a lot of stuff to the script, namely:
  • Fixed layout of script
  • Added much more customization
  • Moved main processing out of class declaration
The music is yet to come.

EDIT: I screwed up, don't use that version! I will fix it in several minutes. The full-screen function will not work with this script!
EDIT EDIT: Works now.
« Last Edit: April 18, 2011, 02:54:09 PM by Welfare-Daddy Pacman »
it's like a metaphor or something i don't know

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Oh my good golly gosh, so many updates today!
I've taken out the scene in the battle test. It was really annoying, and it added some girth to my script that brought it closer to my 200 line goal. :P
it's like a metaphor or something i don't know

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
More updates!
I've updated this to 2.1a, allowing for quicker running by changing the inheritance from Scene_Base to Scene_Title, letting the battle test run smoother and the script to run faster.
it's like a metaphor or something i don't know

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Good work. Your script looks much better now ^_^

Since your scene inherits from Scene_Title there should be no need to create a new Scene_Title.
Code: [Select]
@title = Scene_Title.new
@title.load_database
That could just probably just be changed into:
Code: [Select]
load_database


Consider storing the wanted fullscreen option in the game.ini file. I have made a wrapper which does the Win32APi calls for you: http://pastebin.com/KZyTS6cB
You can then write the setting to the ini file like this:
Code: [Select]
Utility.write_ini('Fullscreen', '1') # Fullscreen mode on
Utility.write_ini('Fullscreen', '0') # Fullscreen mode off
To read from the ini file you can use something like this:
Code: [Select]
if Utility.read_ini('Fullscreen') == '1'
  # Turn fullscreen on automatically and continue
elsif Utility.read_ini('Fullscreen') == '0'
  # Continue in windowed mode
else
  # Fullscreen setting has not been set. Ask the player
end


*hugs*

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Dear lord that's helpful.
I was worrying a bit because if you boot the game up in full-screen and select windowed, it stays in fullscreen because I didn't write to put the game in windowed, just to start the scene.
Also thanks for that title pointout. Doesn't really change much, but it gets rid of a line and a half :P
I'll take a crack at that right now.
And thanks for dropping by on my CP thread.
EDIT: Works great Zeriab! Everything is functioning perfectly.
« Last Edit: April 20, 2011, 07:30:19 AM by Welfare-Daddy Pacman »
it's like a metaphor or something i don't know

***
Rep:
Level 69
RESIDENT ADONKADONK
Awesome!
*adds to game*

I'm back.

**
Rep:
Level 82
Just out of curiosity, but why is the keyboard handle a global variable?  If its to be used throughout a game, that's perfectly fine, but in this case its merely being called once when the game starts, so why not make it a local variable?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Kinda glad you asked, Zer0. Yes, it's intended for people to be able to use it through other means. But you are quite right, and you know my hatred toward unneeded globals. And configuration data defined outside of a module. How dare I?!
This is in need of an update.
it's like a metaphor or something i don't know

***
Rep:
Level 74
I'm baaack!
This is a neat script :D I'm going to use this (b'.')b

EDIT: I selected full-screen and itwindowed my game :(
« Last Edit: September 03, 2011, 02:08:33 PM by Infinate X »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
As I said, this script needs an update. I'm busy beyond reason today, but I'll see what I can do tomorrow.
it's like a metaphor or something i don't know

***
You pie feeders!
Rep:
Level 68
Everyone... Actually Everyone hates me :)
2012 Biggest Drama Whore
probably long past by now, but couldn't you always study on of the auto scripts in the game for the music thing... im sure its in there somewhere otherwise music wouldn't play in the game at all.
Final Statement: I chowder5lock am a dipshit and MA is a pretty cool dude.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I overcame problems like that many months ago. I simply haven't redone this script.
it's like a metaphor or something i don't know

*
Rep: +0/-0Level 57
RMRK Junior
Great script mate , now that RMVX-Ace is out will you be making a new version that is compatible with RMVX-Ace?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I have a draft for one. It has the same problem as this one; if the game is in fullscreen and you select windowed, it remains in fullscreen.
That said, you could probably easily fix this by making F12 exit instead of restart. Would you like me to post it?
it's like a metaphor or something i don't know