Author Topic: [XP] Moving Windows v1.0  (Read 15409 times)

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
[XP] Moving Windows v1.0
« on: January 08, 2008, 09:31:29 PM »
Moving Windows
Authors: Fantasist
Version: 1.0
Type: Graphical Enhancement
Key Term: Misc System

Introduction

Moves a window with a 'decelerating' effect (think STCMS)

Features

  • Moves windows with a 'decelerating' effect rather than plain motion
  • Can handle movement in any direction, just give the window a destination and it will move there

Screenshots

N/A

Demo

Paste this in a new slot just below Scene_Menu and you have your demo (after installing the script of course)

Code: [Select]
class Scene_Menu

  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = 'Status'
    s5 = 'Save'
    s6 = 'End Game'
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.y = -224
    if $game_party.actors.size == 0
      (0..3).each {|i| @command_window.disable_item(i)}
    end
    @command_window.disable_item(4) if $game_system.save_disabled
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = -160
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = -160
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = -160
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 640
    @status_window.y = 0
    # Move the windows
    @command_window.move(0, 0)
    @playtime_window.move(0, 224)
    @steps_window.move(0, 320)
    @gold_window.move(0, 416)
    @status_window.move(160, 0)
   
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
 
  alias moving_wins_test_menu_upd update
  def update
    @command_window.move(0, 0)
    @playtime_window.move(0, 224)
    @steps_window.move(0, 320)
    @gold_window.move(0, 416)
    @status_window.move(160, 0)
    moving_wins_test_menu_upd
  end
 
end


Script

Paste in a new script slot above main.
Code: [Select]
#==============================================================================
# ** Moving Windows
#------------------------------------------------------------------------------
# by Fantasist
# Version: 1.0
# Date: 14-Sep-2009
#------------------------------------------------------------------------------
# Version History:
#
#   1.0 - First version
#------------------------------------------------------------------------------
# Description:
#
#     This script adds moving functionality to windows.
#------------------------------------------------------------------------------
# Compatibility:
#
#     Might not be compatible with other similar scripts.
#------------------------------------------------------------------------------
# Instructions:
#
#     Paste this script below "Window_Base" and above "Main".
#
#     The syntax for moving a window is:
#
#           my_window.move(dest_x, dest_y[, move_speed])
#
#     where
#           dest_x: Destination X coordinate
#           dest_y: Destination Y coordinate
#           move_speed (optional): Speed divider. Larger numbers means faster.
#
#     The attributes "dest_x", "dest_y" and "move_speed" can be used directly
#     without using the "move" function all the time.
#
#     The "moving?" function returns "true" if the windows are in motion. This
#     can be used as an event in exotic systems of all sorts :)
#------------------------------------------------------------------------------
# Issues:
#
#     None known.
#------------------------------------------------------------------------------
# Credits and Thanks:
#
#   Fantasist - For making this.
#------------------------------------------------------------------------------
# Notes:
#
#   If you have any questions, suggestions or comments, you can find me at:
#
#    - www.chaos-project.com
#    - www.quantumcore.forumotion.com
#
#   Enjoy ^_^
#==============================================================================

#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Attributes
  #--------------------------------------------------------------------------
  attr_accessor :dest_x
  attr_accessor :dest_y
  attr_accessor :move_speed
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias move_wins_winbase_init initialize
  def initialize(x, y, width, height)
    move_wins_winbase_init(x, y, width, height)
    self.dest_x = x
    self.dest_y = y
    self.move_speed = 3
  end
  #--------------------------------------------------------------------------
  # * Moving?
  #--------------------------------------------------------------------------
  def moving?
    return (self.x != self.dest_x || self.y != self.dest_y)
  end
  #--------------------------------------------------------------------------
  # * Move
  #--------------------------------------------------------------------------
  def move(dest_x, dest_y, move_speed = nil)
    self.dest_x = dest_x
    self.dest_y = dest_y
    self.move_speed = move_speed unless move_speed.nil?
  end
  #--------------------------------------------------------------------------
  # * Move Wins
  #--------------------------------------------------------------------------
  def move_wins
    dx = (self.dest_x - self.x).to_f / self.move_speed
    dy = (self.dest_y - self.y).to_f / self.move_speed
    # Decimal correction
    dx = self.dest_x > self.x ? dx.ceil : dx.floor
    dy = self.dest_y > self.y ? dy.ceil : dy.floor
    # Moving
    self.x += dx
    self.y += dy
  end
  #--------------------------------------------------------------------------
  # * x=
  #--------------------------------------------------------------------------
  def x=(val)
    self.dest_x = val unless moving?
    super(val)
  end
  #--------------------------------------------------------------------------
  # * y=
  #--------------------------------------------------------------------------
  def y=(val)
    self.dest_y = val unless moving?
    super(val)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias move_wins_winbase_update update
  def update
    move_wins_winbase_update
    move_wins if moving?
  end
end

(click to show/hide)

Instructions

Paste this script below "Window_Base" and above "Main".

The syntax for moving a window is:
Code: [Select]
my_window.move(dest_x, dest_y[, move_speed])
where
     dest_x: Destination X coordinate
     dest_y: Destination Y coordinate
     move_speed (optional): Speed divider. Larger numbers means faster.

   The attributes "dest_x", "dest_y" and "move_speed" can be used directly without using the "move" function all the time.

   The "moving?" function returns "true" if the windows are in motion. This can be used as an event in exotic systems of all sorts :)

Compatibility

Might not be compatible with other similar scripts.

Credits and Thanks

Credit Fantasist (me) for making it.

Author's Notes

If you have any questions, suggestions or comments, you can find me at:

 - www.chaos-project.com
 - www.quantumcore.forumotion.com

Enjoy ^_^
« Last Edit: September 14, 2009, 03:24:42 PM by Fantasist »
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Nortos

  • Has earned a custom title
  • Chaos User
  • ******
  • Posts: 1303
  • LV: 20
  • Gender: Male
  • Celestial Bomb my Digital Ass
    • View Profile
Re: Basic Moving Windows
« Reply #1 on: January 09, 2008, 12:59:22 AM »
was this ur first script you made when you started scripting?
(click to show/hide)
Nortos's Stealth System
UltaFlame's Storyline Service
Blizz ABS - The Ultimate ABS!
My Resources

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Basic Moving Windows
« Reply #2 on: January 10, 2008, 07:10:09 AM »
My first complete script is my Battle Cursor (now integrated into Tons). My first scripting was mods to the CMS. Changed the window positions and things like that.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Calintz

  • Guardian of Chaos
  • ********
  • Posts: 3803
  • LV: 108
  • Gender: Male
  • A Pixel's Worst Nightmare
    • View Profile
Re: Basic Moving Windows
« Reply #3 on: January 10, 2008, 10:35:22 PM »
Could you maybe post an example of when this script would be good to use?

Offline Nortos

  • Has earned a custom title
  • Chaos User
  • ******
  • Posts: 1303
  • LV: 20
  • Gender: Male
  • Celestial Bomb my Digital Ass
    • View Profile
Re: Basic Moving Windows
« Reply #4 on: January 11, 2008, 02:47:19 AM »
it animates windows if I'm correct? Makes them slide into place like Blizz's cms I think with all windows u want it to
(click to show/hide)
Nortos's Stealth System
UltaFlame's Storyline Service
Blizz ABS - The Ultimate ABS!
My Resources

Offline Calintz

  • Guardian of Chaos
  • ********
  • Posts: 3803
  • LV: 108
  • Gender: Male
  • A Pixel's Worst Nightmare
    • View Profile
Re: Basic Moving Windows
« Reply #5 on: January 11, 2008, 05:15:33 AM »
Interesting...I'll tinker with it, and see for myself  ;D

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Basic Moving Windows
« Reply #6 on: January 12, 2008, 12:54:20 AM »
A quick edit eh? I'll edit the main post in a bit.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Juan

  • Ethereal Devastator
  • ****
  • Posts: 409
  • LV: 48
  • Gender: Male
  • Evil Twin
    • View Profile
Re: Basic Moving Windows
« Reply #7 on: January 12, 2008, 08:53:31 AM »
@Fantasist Great work and could be useful for people who might want to animate menus.
Dropbox Who need luck when you can make your own.
(click to show/hide)

Offline Sally

  • Sallygirl :P
  • Chaos User
  • ******
  • Posts: 1283
  • LV: 12
  • Gender: Female
    • View Profile
Re: Basic Moving Windows
« Reply #8 on: January 12, 2008, 09:09:48 AM »
i wish i could script...

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Basic Moving Windows
« Reply #9 on: January 12, 2008, 03:59:21 PM »
Then why not learn? :D

@Juan, thanks :) You might be wondering what what all that ceils and rounds are for. Well, the code could be smaller but for some reason, the windows don't end up exactly in their destination and leave a pixel or two. I had to hard code the correction, hence why this version is alpha. I planned more glorious things. This is one feature of my Windows Plus pack, which has many enter-exit effects and lots of stuff.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Juan

  • Ethereal Devastator
  • ****
  • Posts: 409
  • LV: 48
  • Gender: Male
  • Evil Twin
    • View Profile
Re: Basic Moving Windows
« Reply #10 on: January 13, 2008, 08:09:56 AM »
@Fantasist Sounds like some intersting features.
Dropbox Who need luck when you can make your own.
(click to show/hide)

Offline Calintz

  • Guardian of Chaos
  • ********
  • Posts: 3803
  • LV: 108
  • Gender: Male
  • A Pixel's Worst Nightmare
    • View Profile
Re: Basic Moving Windows
« Reply #11 on: January 13, 2008, 08:11:21 AM »
I've been reading some Tutorials myself. The beginner stuff is really easy to learn, but then agaian, I haven't gotten into the muck of it yet, so... ;D

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Basic Moving Windows
« Reply #12 on: January 13, 2008, 11:55:20 AM »
The muck of it is the best part in scripting Calintz ;)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Nortos

  • Has earned a custom title
  • Chaos User
  • ******
  • Posts: 1303
  • LV: 20
  • Gender: Male
  • Celestial Bomb my Digital Ass
    • View Profile
Re: Basic Moving Windows
« Reply #13 on: January 13, 2008, 12:02:43 PM »
so true I'm still all confuzzled in the muck but it's fun :P more than the first couple tuts but I still refer back every now and than
(click to show/hide)
Nortos's Stealth System
UltaFlame's Storyline Service
Blizz ABS - The Ultimate ABS!
My Resources

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP] Basic Moving Windows
« Reply #14 on: February 22, 2008, 04:47:34 PM »
ftw! stupid git! *deletes post*

That post, posted by stodophidwits as a Guest, had about 60 lines of links to porn, all in html. (<a href=http:.....)Was that a sick joke or was it a response to my last post?
Quote
The muck of it is the best part in scripting Calintz

Either way, sorry if I souldn't have done it Bliz, but check the recycle topic and decide... or hey, should I post it in the mod f... oops, said too much!
« Last Edit: February 22, 2008, 04:48:58 PM by Fantasist »
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Vell

  • Lexima Warrior
  • *******
  • Posts: 2915
  • LV: 49
  • Doubt for the dead.
    • View Profile
Re: [XP] Basic Moving Windows
« Reply #15 on: February 22, 2008, 06:16:22 PM »
he posted another one, so i deleted it again...

Offline Nortos

  • Has earned a custom title
  • Chaos User
  • ******
  • Posts: 1303
  • LV: 20
  • Gender: Male
  • Celestial Bomb my Digital Ass
    • View Profile
Re: [XP] Basic Moving Windows
« Reply #16 on: February 23, 2008, 02:50:53 AM »
I know about the mod ... thingy anyway :P I saw it once when Blizz forgot to lock it to the usergroup I was in but I never went in, you all probably rave on about how good looking I'm anyway :P
(click to show/hide)
Nortos's Stealth System
UltaFlame's Storyline Service
Blizz ABS - The Ultimate ABS!
My Resources

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Basic Moving Windows
« Reply #17 on: February 23, 2008, 04:05:46 PM »
It's full of porn. #_# The others filled it completely up within just one week. #_#
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Nortos

  • Has earned a custom title
  • Chaos User
  • ******
  • Posts: 1303
  • LV: 20
  • Gender: Male
  • Celestial Bomb my Digital Ass
    • View Profile
Re: [XP] Basic Moving Windows
« Reply #18 on: February 24, 2008, 09:45:44 AM »
lol *looks at Ulta*
(click to show/hide)
Nortos's Stealth System
UltaFlame's Storyline Service
Blizz ABS - The Ultimate ABS!
My Resources

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: [XP] Moving Windows v1.0
« Reply #19 on: September 14, 2009, 03:25:22 PM »
Updated. I've FINALLY got the decimal correction right! :D
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews