irpg Community

Full Version: สคริปมีปัญหา
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
เป็นสคริปบอกพิกัด X Y อะครับ
พอใช้แล้วเป็นรูปแบบนี้อะครับ
อยากจะรู้ว่าผิดที่โค้ดหรือว่ายังไงอะครับ ??
[Image: foZ8i0.jpg]
Quote:#==============================================================================#
# Game Guy's Coordinate Displayer #
#==============================================================================#
=begin
This will show a window on the map displaying X and Y coordinates.

Customization
module
Location = "Upper Right Corner" "Lower Left Corner" "Upper Left Corner" or "Lower Right Corner"
Transparent = "Non Transparent" "Semi-Transparent" "Transparent"
UsePicture = true or false if set to true and transparent = "Non Transparent" it will automatically set it to "Transparent"
PictureName = "picture name here" must be in quotes
end
=end
LOCATION = "Upper Right Corner"
TRANSPARENT = "Semi-Transparent"
USEPICTURE = false #NOT WORKING YET SO GO AHEAD AND SET IT TO TRUE BUT STILL WONT WORK
PICTURENAME = "picture name here"
class Window_Coordinate < Window_Base

def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "X: " + $playerx.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, "Y: " + $playery.to_s)
end

def update
super
$playerx = $game_player.x * 32
$playery = $game_player.y * 32
refresh
end

end

class Scene_Map

alias add_coordinate_window_later main
def main
if $DEBUG
@coordinate = Window_Coordinate.new
if LOCATION == "Upper Right Corner"
@coordinate.x = 480
elsif LOCATION == "Upper Left Corner"
@coordinate.x = 0
elsif LOCATION == "Lower Right Corner"
@coordinate.x = 480
@coordinate.y = 374
else
@coordinate.y = 374
end
if USEPICTURE == true
if TRANSPARENT == "Non Transparent"
@coordinate.opacity = 0
@coordinate.back_opacity = 0
end
end
if TRANSPARENT == "Transparent"
@coordinate.opacity = 0
@coordinate.back_opacity = 0
elsif TRANSPARENT == "Semi-Transparent"
@coordinate.opacity = 155
@coordinate.back_opacity = 155
else
@coordinate.opacity = 255
@coordinate.back_opacity = 255
end
end
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@coordinate.dispose
@message_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
Graphics.freeze
end

alias update_coordinate_window_later update
def update
if $DEBUG
if @coordinate.active
update_coordinate
end
end
update_coordinate_window_later
end

def update_coordinate
if $DEBUG
if Input.trigger?(Input::A)
if @coordinate.visible
@coordinate.visible = false
else
@coordinate.visible = true
end
end
@coordinate.update if @coordinate.visible && @coordinate.active
end
end
end
http://forum.chaos-project.com/index.php?topic=2972.0 <---ใช่อันนี้รึเปล่าครับ?
ผมลองเอามาใส่ก็ปกติดีนะครับ หากกลัวว่าสคริปตีกันก็ลองเอาสคริปนี้ไปอยู่ล่างสุดดูนะครับ(แต่ยังเหนือ main อยู่นะ)

[Image: test_zps87d4e94d.jpg]
ถ้ายังไม่ได้อยู่เดี๋ยวไว้ผมส่งตัวโปรเจคที่ลองใส่สคริปให้อีกทีแล้วกันครับ แต่ยังใงก็ลองดูก่อนครับ
;3

โปรแกรมฟ้องเรื่องการใช้เมธอด dispose ครับ

ลองใช้สคริปต์ของท่านB.o.N. ดูนะครับ
ก็ยังไม่ได้อะครับ ผมลองสร้างตัวติดตั้งแล้วทดสอบรันดู ก็ยังเหมือนเดิมเลยอะครับ ปล. ผมใช้RPG maker xp 1.03นะครับ