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

0 Members and 1 Guest are viewing this topic.

*
I love Firerain
Rep:
Level 97
=D
they still say failed to create bitmap
AND
the error is always on the line 13
(Bitmap.new one)
or 46 in Zeriabs (same bitmap one)
Arlen is hot.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Try to insert this right above 'self.contents = Bitmap.new(width, height)'

Code: [Select]
p width, height

If you get a popup with 2 nils that is the reason of the failure.

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Or two zeros or one zero. Believe me, I tried it.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*
I love Firerain
Rep:
Level 97
=D
i get 2 0's
and the same error
AGAIn
Arlen is hot.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
I wouldn't know what's going on, unless you have Map with no name, except you have spaces in it.
That's all I can think of.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
I love Firerain
Rep:
Level 97
=D
all of my maps have a one word name
Arlen is hot.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Then I can't help you, sadly.

What line gives the error? (I think it would be obvious, but you never know)
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
I love Firerain
Rep:
Level 97
=D
the same bitmap one i spose
Arlen is hot.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Try replacing the Win_Size class with the following -

Code: [Select]
class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      if @w == 0
         @w = 200
      elsif @h == 0
         @h = 80
      end
      self.dispose
   end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end

This way it should return 200 * 80 if the values are zero.

But I don't know how'd they would get that way in the first place.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

**
Rep: +0/-0Level 88
Hello
The script doesn't work, says something about syntax error

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
This is the newest version -

Code: [Select]
class Floating_Location < Window_Base

      def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
      super(0, 0, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 100
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 10
            self.back_opacity -= 10
            self.contents_opacity -=10
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      if @w == 0
         @w = 200
      elsif @h == 0
         @h = 80
      end
      self.dispose
   end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end

And to disable the window on a map, just make the map have no name, no spaces either.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

**
Rep: +0/-0Level 88
Hello
Man, the same old error:
Code: [Select]
line 18 RGSS error, failed to create bitmap

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Well, something weird is going on here, because this is line 18 =

Code: [Select]
self.back_opacity = 240

And the bitmap is created way before that...

Did you paste the entire script I supplied above main in one slot?
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

**
Rep: +0/-0Level 88
Hello
Meh sorry, it says 'line 13'

**
Rep:
Level 88
Where's the head of a chocolate coronet? :O
Oooo...interesting script. I like it.

---

So far i'm not getting any errors.

**
Rep:
Level 87
Ontamarama FTW! :D
wow!, this script is awesome, very nice script!  ;8

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Here's a version where you can specify which maps you want the feature disabled for:
Also... I fixed a small issue where the code checks if the @floating_location is disposed before it checks for nil. Should be the other way around as the nil class don't have the disposed? method.

Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map
   DISABLED_MAP_IDS = [2,3] # Change this to the map IDs of the map you don't want the feature for.

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      unless DISABLED_MAP_IDS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
      main_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                         @floating_location.disposed?)
   end

   def update
      @floating_location.update unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      unless DISABLED_MAP_IDS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
   end
end
« Last Edit: May 10, 2007, 09:20:20 PM by Zeriab »

**
Rep:
Level 87
Here's a version where you can specify which maps you want the feature disabled for:
Also... I fixed a small issue where the code checks if the @floating_location is disposed before it checks for nil. Should be the other way around as the nil class don't have the disposed? method.

Good script, I've got it working for the most part.  There's a problem though whenever I'm in an area where the Floating Location Window is active.  When I access the menu and then exit it, the FLW shows up again.  It only needs to show up when the player enters the area from an outside location.  Any idea how to fix this?

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.

Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map
   DISABLED_NUMBERS = [2,3] # Change this to the map IDs of the map you don't want the feature for.
   ENABLED_SWITCH = 5 # The Switch Number

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      unless !$game_switches[ENABLED_SWITCH] or
              DISABLED_NUMBERS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
      main_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                         @floating_location.disposed?)
   end

   def update
      @floating_location.update unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.nil? or
                                        @floating_location.disposed?)
      unless !$game_switches[ENABLED_SWITCH] or
              DISABLED_NUMBERS.include?($game_map.map_id)
        @floating_location = Floating_Location.new
      end
   end
end

**
Rep:
Level 87
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.
Thanks!  I appreciate the help.

**
Rep: +0/-0Level 87
... is there any way I can completely disable the script and then call it up again later? I'm trying to stop the map names from popping up during cutscenes.

Any help would be greatly appreciated.


Note: I'm looking for something to actually disable the script... the maps the cutscenes interchange on are both enormous and widely used.
« Last Edit: June 12, 2007, 10:04:52 PM by DarkLordX »

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Here:
Just turn the switch specified at line 113 on and off.
If the switch is ON the message will be displayed, though only if it is on an allowed map.
If the switch is OFF the message will never be displayed.

If you have just copied and pasted the script then you have
Code: [Select]
ENABLED_SWITCH = 5 # The Switch Number
Just turn switch 5 off during cutscenes and on again afterwards.

**
Rep: +0/-0Level 87
Ah... thanks Zeriab. I'd thought that was referring only to the map allowed/disallowed function... my bad.

Btw... sent you an email due to the fact that Brewmeister hasn't been on in a good while.

**
Rep: +0/-0Level 86
I'm sorry, just wondering since I have Blizz's ABS script with HUD enable it overlaps the loaction window  :-\. Could someone please explain to me how to change the coordinents (not sure how to spell that  :-[) of the window?


Current Games:
Darklands (Demon Slayer [new name])

Scripting - About 55% complete.

Eventing - About 1% complete.

Mapping - About .5% complete.

Spriting - 0% complete.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Most Mature Member2011 Favourite Staff Member2011 Best Use of Avatar and Signature Space2011 Best Veteran2011 Best RPG Maker User (Scripting)2010 Best RPG Maker User (Scripting)2010 Most Mature Member
@Ericmor: Good try, but you're not quite there. (Except the first)

Here's an 'enhanced' script while we wait for Tsuno to make a proper one. (Yes I am lazy)
You can change the alignment of the window rather easily here. Script:
Code: [Select]
class Floating_Location < Window_Base
   #--------------------------------------------------------------------------
   # The position of the window
   # [x,y]
   #
   # x = 1 => left
   # x = 2 => center
   # x = 3 => right
   #
   # y = 1 => top
   # y = 2 => center
   # y = 3 => bottom
   #--------------------------------------------------------------------------
   POSITION = [2,3]
   def initialize
      @map_name = get_name
      if @map_name == ""
            @size = [32,32]
      else
            @size = Win_Size.new(@map_name)
      end
      width = @size[0]
      height = @size[1]
     
      case POSITION[0]
      when 1
        ox = 0
      when 2
        ox = 640-(width+32)
        ox = ox/2
      when 3
        ox = 640-(width+32)
      end
     
      case POSITION[1]
      when 1
        oy = 0
      when 2
        oy = 480-(height+32)
        oy = oy/2
      when 3
        oy = 480-(height+32)
      end
     
      super(ox, oy, width+32, height+32)
      self.contents = Bitmap.new(width, height)
      if @map_name == ""
            self.visible = false
      else     
            self.opacity = 240
            self.back_opacity = 240
            self.contents_opacity = 240
      end
      @frame_wait = Graphics.frame_count + 60
      refresh
   end

   def refresh
      self.contents.font.color = Color.new(217,87,0,255)
      self.contents.draw_text(0, 0, @size[0], @size[1], @map_name)
   end

   def update
      if @map_name == ""
         self.dispose
         return
      end
      if get_name != @map_name
         self.dispose
         return
      end
      if @frame_wait <= Graphics.frame_count
         if self.opacity > 0
            self.opacity -= 20
            self.back_opacity -= 20
            self.contents_opacity -= 20
         else
            self.dispose
            return
         end
      end
   end

   def get_name
      data = load_data("Data/MapInfos.rxdata")
      data[$game_map.map_id].name
   end

end

class Win_Size < Window_Base
   
   def initialize(text)
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(640 - 32, 480 - 32)
      @w = contents.text_size(text).width
      @h = contents.text_size(text).height
      self.dispose
    end
   
   def [](value)
     if value == 0
       return @w
     else
       return @h
     end
   end

end
 
class Scene_Map

   alias   :main_orig   :main
   alias   :update_orig   :update
   alias   :transfer_player_orig  :transfer_player

   def main
      @floating_location.dispose unless @floating_location.nil?
      @floating_location = Floating_Location.new
      main_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                         @floating_location.nil?)
   end

   def update
      @floating_location.update unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      update_orig
   end
   
   def transfer_player
      transfer_player_orig
      @floating_location.dispose unless (@floating_location.disposed? or
                                        @floating_location.nil?)
      @floating_location = Floating_Location.new
   end
end
Just change the values in 'POSITION = [2,3]'
Change the 2 and 3 to whatever value you feel like.

For the first value:
1 => left
2 => center
3 => right

For the second value
1 => top
2 => center
3 => bottom

So in this case the window will be placed in the center on the bottom of the screen.


I know this is rather sucky, but then again... I only used 10 minutes on this.