Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RMXP ถามที!!!! (สคริปต์ยำเละ)
#1
Bug 
พอดีว่าผมกำลังยำสคริปต์ใหม่ๆ อยู่นะครับ แล้วลองเปิดดู

ครั้งแรก
[Image: rmxpissue0001before.jpg]

พอกด F12 ปุ๊บ
[Image: rmxpissue0001after.jpg]

พอมาดูสริปต์

Code:
#==============================================================================
# ** Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias admannon_bitmap_initialize initialize
  def initialize(*args)
    admannon_bitmap_initialize(*args)
    @BitmapPlusDLL = "D:/Peerakarn/Documents/C Language/BitmapPlus/bin/Debug/"
  end
  #--------------------------------------------------------------------------
  # * Get/Set Bitmap Plus DLL
  #--------------------------------------------------------------------------
  def BitmapPlusDLL
    return @BitmapPlusDLL
  end
  def BitmapPlusDLL=(bmpdll)
    @BitmapPlusDLL = bmpdll
  end
  #--------------------------------------------------------------------------
  # * Get Color Zone
  #--------------------------------------------------------------------------
  def color_zone()
    dll = Win32API.new(@BitmapPlusDLL + "BitmapPlus.dll", "Trim", "ll", "l")
    area = Rect.new(0, 0, 0, 0)
    area.x = dll.call(self.__id__, 0)
    area.y = dll.call(self.__id__, 1)
    area.width = dll.call(self.__id__, 2) - area.x
    area.height = dll.call(self.__id__, 3) - area.y
    return area
  end
  #--------------------------------------------------------------------------
  # * Text Size
  #--------------------------------------------------------------------------
  alias bitmap_text_size text_size
  def text_size(str, trimmode = false)
    if trimmode
      text_size = Size.new
      text = Bitmap.new(640, self.font.size + 12)
      text.draw_text(0, 0, 640, font.size + 12, str, 1)
      text_size.width = text.color_zone.width + 2
      text_size.height = $font_height
      return text_size
    else
      return bitmap_text_size(str)
    end
  end
end

ใครก็ได้ช่วยผมที ขอบคุณล่วงหน้า
Reply
#2
อันนี้ผมแนะนำให้ลิสท์เลยดีกว่าว่าใส่สคริปต์อะไรลงไปมั่ง บางทีมันไม่ได้เสียที่ตรงสคริปต์ส่วนที่มันแจ้งหรอกงับ (ในที่นี้ก็คือ Bitmap) ผมว่ามันเกิดขึ้นจากการที่เราใส่มากเกินไปจนมันซ้ำซ้อน เลยพังไปเลย วิธีแก้ผมแนะนำให้เอาออกทีละตัวจนกว่าจะเข้าเกมได้ แล้วจะได้หาตัวที่ทำเสียได้งับ
[Image: 7wDGQYA.png][Image: 76561197983021669.png]
Reply
#3
บางสคริปต์ทำให้เกิดอาการนี้ครับ ;w;/ ซึ่งสคริปต์ที่จะมีปัญหาคือสคริปต์ที่มีการ alias module

แนะนำว่าให้ปล่อยผ่านไปครับ เพราะอันนี้ไม่ใช่ปัญหาใหญ่เลย คนเล่นเกมทั่วไปเค้าไม่มากด F12 กันอยู่แร้นครับ Big Grin (ถ้าเราไม่บอกว่ามันกดได้)
คิดถึง แพนด้าจ๊าก
Reply
#4
(07-17-2012, 07:46 PM)Neoz Kaho Wrote: อันนี้ผมแนะนำให้ลิสท์เลยดีกว่าว่าใส่สคริปต์อะไรลงไปมั่ง บางทีมันไม่ได้เสียที่ตรงสคริปต์ส่วนที่มันแจ้งหรอกงับ (ในที่นี้ก็คือ Bitmap) ผมว่ามันเกิดขึ้นจากการที่เราใส่มากเกินไปจนมันซ้ำซ้อน เลยพังไปเลย วิธีแก้ผมแนะนำให้เอาออกทีละตัวจนกว่าจะเข้าเกมได้ แล้วจะได้หาตัวที่ทำเสียได้งับ

Console Output
Code:
#==============================================================================
# ** Inner Console Output
#==============================================================================

if false
  
  if $DEBUG || $TEST
    
    # Create a console object and redirect standard output to it.
    Win32API.new('kernel32', 'AllocConsole', 'V', 'L').call
    $stdout.reopen('CONOUT$')
    # Find the game title.
    ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
    title = "\0" * 256
    ini.call('Game', 'Title', '', title, 256, '.\\Game.ini')
    title.delete!("\0")
    # Set the game window as the top-most window.
    hwnd = Win32API.new('user32', 'FindWindowA', 'PP', 'L').call('RGSS Player', title)  
    Win32API.new('user32', 'SetForegroundWindow', 'L', 'L').call(hwnd)
    # Set the title of the console debug window'
    Win32API.new('kernel32','SetConsoleTitleA','P','S').call("#{title} :  Debug Console")
    # Draw the header, displaying current time.
    dim = [32, 32, 256, 480]
    console = Win32API.new('kernel32', 'GetConsoleWindow', 'V', 'L').call
    swp = Win32API.new('user32', 'SetWindowPos', 'LLIIIII', 'I')
    swp.call(console, 0, dim[0], dim[1], dim[2] + 6, dim[3] + 26, -1)
  end
  
  alias zer0_console_inspect puts
  def puts(*args)
    inspected = args.collect {|arg| arg.inspect.gsub(',') { "\n" } }
    zer0_console_inspect(*inspected)
  end
  
end

Structure (กึ่งคิดเอง)
Code:
#==============================================================================
# ** Structure
#==============================================================================

Size = Struct.new(:width, :height)

Point = Struct.new(:x, :y)

ICurve (คิดเอง)
Code:
#==============================================================================
# ** ICurve
#------------------------------------------------------------------------------
#  This module is for the more movement than Linear
#==============================================================================

module ICurve
  #--------------------------------------------------------------------------
  # * Accelerate
  #--------------------------------------------------------------------------
  def self.accelerate(t, f = 2)
    t.abs ** f
  end
  #--------------------------------------------------------------------------
  # * Decelerate
  #--------------------------------------------------------------------------
  def self.decelerate(t, f = 2)
    1 - (t - 1).abs ** f
  end
  #--------------------------------------------------------------------------
  # * AccelerateDecelerate
  #--------------------------------------------------------------------------
  def self.acceleratedecelerate(t, f = 2, fx = 1.5)
    if t < 0.5
      2 ** ((f * fx) - 1) * t.abs ** (f * fx)
    else
      1 - 2 ** ((f * fx) - 1) * (t - 1).abs ** (f * fx)
    end
  end
  #--------------------------------------------------------------------------
  # * Anticipate
  #--------------------------------------------------------------------------
  def self.anticipate(t, f = 2)
    t ** 2 * ((f + 1.0) * t - f)
  end
  #--------------------------------------------------------------------------
  # * Overshoot
  #--------------------------------------------------------------------------
  def self.overshoot(t, f = 2)
    (t - 1) ** 2 * ((f + 1) * (t - 1) + f) + 1.0
  end
  #--------------------------------------------------------------------------
  # * AnticipateOvershoot
  #--------------------------------------------------------------------------
  def self.anticipateovershoot(t, f = 2, fx = 1.5)
    if(t < 0.5)
      0.5 * self.anticipate(t * 2, f * fx)
    else
      0.5 * (self.overshoot(t * 2 - 1, f * fx) + 1)
    end
  end
  #--------------------------------------------------------------------------
  # * Smooth Bounce
  #--------------------------------------------------------------------------
  def self.smoothbounce(t, b = 5)
    1 - self.accelerate(t - 1) * Math.sin(Math::PI * (b + 0.5) * (t - 1)).abs
  end
  #--------------------------------------------------------------------------
  # * Smooth Wobble
  #--------------------------------------------------------------------------
  def self.smoothwobble(t, b = 5)
    1 - self.accelerate(t - 1) * Math.sin(Math::PI * (2 * b - 0.5) * (t - 1))
  end
end

Graphics (กึ่งคิดเอง)
Code:
#==============================================================================
# ** Graphics
#==============================================================================

module Graphics
  #--------------------------------------------------------------------------
  # * Pause Animation (NOT 'sleep' Function)
  #--------------------------------------------------------------------------
  def self.pause(t)
    while t > 0
      self.update
    end
  end
  #--------------------------------------------------------------------------
  # * FPS and MSPF
  #--------------------------------------------------------------------------
  @Fps = self.frame_rate
  @Mspf = [1000.0 / @Fps]
  @Mspf_Size = self.frame_rate
  def self.FPS
    1000.0 / self.MSPF
  end
  def self.MSPF
    mspf = 0
    for i in @Mspf
      mspf += i.to_f
    end
    mspf /= @Mspf.size
    return mspf
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  class << self
    alias admannon_graphic_update update
  end
  def self.update
    if @Mspf.size < @Mspf_Size
      @Mspf.push(Time.now)
    else
      @Mspf.reverse!.pop
      @Mspf.reverse!.push(Time.now)
    end
    admannon_graphic_update
    @Mspf[@Mspf.size - 1] = Time.now - @Mspf[@Mspf.size - 1]
    @Mspf[@Mspf.size - 1] = @Mspf[@Mspf.size - 1] * 1000 + 3
  end
end

ยิ่งลบยิ่งเจอ แก้ไม่ถูก โดเรมอน 4
Reply
#5
Windows 8 Me gusta
[Image: thumbnail?url=http%3A%2F%2Fpleated-jeans...=272&h=150]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)