We don't discriminate!! :3
私達は区別しない
Welcome Guest [Log In] [Register]
Add Reply
Script?; New number?
Topic Started: Mar 16 2005, 11:57 PM (481 Views)
korgone
Member Avatar
That Korgone Kid
Does any one have a better input number ruby script because my last number gets cut of and the positioning is way out of position <_<
Posted Image
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

I believe I have one, somewhere.

Edit: On a game that's on the computer that I can't access right now.
It'll have to wait.
Offline Profile Quote Post Goto Top
 
korgone
Member Avatar
That Korgone Kid
ok *sigh*
Posted Image
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

Aaand heere we go.

Code:
 
#==============================================================================
# ■ Window_InputNumber
#------------------------------------------------------------------------------
#  メッセージウィンドウの内部で使用する、数値入力用のウィンドウです。
#==============================================================================

class Window_InputNumber < Window_Base
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     digits_max : 桁数
 #--------------------------------------------------------------------------
 def initialize(digits_max)
   @digits_max = digits_max
   @number = 0
   # 数字の幅からカーソルの幅を計算 (0~9 は等幅と仮定)
   dummy_bitmap = Bitmap.new(32, 32)
   @cursor_width = dummy_bitmap.text_size("0").width + 21
   dummy_bitmap.dispose
   super(0, 0, @cursor_width * @digits_max + 64, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   self.z += 9999
   self.opacity = 0
   @index = 0
   refresh
   update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # ● 数値の取得
 #--------------------------------------------------------------------------
 def number
   return @number
 end
 #--------------------------------------------------------------------------
 # ● 数値の設定
 #     number : 新しい数値
 #--------------------------------------------------------------------------
 def number=(number)
   @number = [[number, 0].max, 10 ** @digits_max - 1].min
   refresh
 end
 #--------------------------------------------------------------------------
 # ● カーソルの矩形更新
 #--------------------------------------------------------------------------
 def update_cursor_rect
   self.cursor_rect.set(@index * @cursor_width, 0, @cursor_width, 32)
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 def update
   super
   # 方向ボタンの上か下が押された場合
   if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
     $game_system.se_play($data_system.cursor_se)
     # 現在の位の数字を取得し、いったん 0 にする
     place = 10 ** (@digits_max - 1 - @index)
     n = @number / place % 10
     @number -= n * place
     # 上なら +1、下なら -1
     n = (n + 1) % 10 if Input.repeat?(Input::UP)
     n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
     # 現在の位の数字を再設定
     @number += n * place
     refresh
   end
   # カーソル右
   if Input.repeat?(Input::RIGHT)
     if @digits_max >= 2
       $game_system.se_play($data_system.cursor_se)
       @index = (@index + 1) % @digits_max
     end
   end
   # カーソル左
   if Input.repeat?(Input::LEFT)
     if @digits_max >= 2
       $game_system.se_play($data_system.cursor_se)
       @index = (@index + @digits_max - 1) % @digits_max
     end
   end
   update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   s = sprintf("%0*d", @digits_max, @number)
   for i in 0...@digits_max
     self.contents.draw_text(i * @cursor_width + 4, 0, 32, 32, s[i,1])
   end
 end
end

That should do the trick. Sorry for taking so long time.
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
Hehe, I actually understand some of that code. Weee!
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

You can stop now.
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
:( Must I? I feel so special :P
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

*cuts off your arms* Now that's special. =D
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
Can I constantly go one about being a one armed freak then?
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

A no armed freak.


=)
Offline Profile Quote Post Goto Top
 
Alastyr

Don't worry Dorito, it's only a flesh wound.
Offline Profile Quote Post Goto Top
 
Otyo

Yeah. Some potions should heal that up in no-time. Unless it's a plot shift. :0
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
*Uses feet to cast random spell of arm regeneration*
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

Oh wow. :0
Offline Profile Quote Post Goto Top
 
Alastyr

That takes talent :lol:
Offline Profile Quote Post Goto Top
 
Otyo

It does, indeed! :lol:
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
Took years of practice too. And now...FOR VENGEANCE. *Cuts OTYOS arms off*
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

*grows arms back on*

._.

Demon powah.

=D rawr'n stuff. *throws forks after you*
Offline Profile Quote Post Goto Top
 
Dorito
Member Avatar
Slice.
:o *does crash bandicoot spin and sends fork back at you*
Posted Image
Offline Profile Quote Post Goto Top
 
Otyo

OH NOES :0 *dies*

This thing has gone terribly off-topic now. :0
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Help · Next Topic »
Add Reply

Theme by tiptopolive of Self Concept