Geeked
Pokemon Crimson Version
- 352
- Posts
- 17
- Years
- Seen Oct 9, 2012
Hey, I'm trying to use the latest Dual Screen Script by CNG
This one:
I am using the latest Mouse module, and I have the September 5th release of essentials. I get this error:
"Script 'Dual Screen' line 192: SyntaxError occured."
Line 192 is
This one:
Spoiler:
PHP:
# Set this to true if you use the mouse module
USE_MOUSE = true
class Sprite_Picture
def initialize(viewport, picture)
@viewport = Viewport.new(0, 0, 480, 670)
@picture = picture
@sprite = nil
update
end
end
module Resolution
GetWindowPlacement = Win32API.new('user32','GetWindowPlacement',['l','p'],'l')
GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics',['i'],'i')
MoveWindow = Win32API.new('user32','MoveWindow',['l','i','i','i','i','l'],'l')
FindWindowEx = Win32API.new('user32','FindWindowEx',['l','l','p','p'],'i')
def self.windowloc(window)
string = ' ' * 44
Resolution::GetWindowPlacement.call(window,string)
windowdetails = string.unpack('L11')
result = []
result.push((windowdetails[9] - windowdetails[7]))
result.push((windowdetails[10] - windowdetails[8]))
result.push(windowdetails[7])
result.push(windowdetails[8])
return result
end
end
class Screen
def self.center
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
width,height = Resolution.windowloc(window)[0..1]
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1)
end
def self.resize2(width,height,x,y)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
def self.move(x,y)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
width,height = Resolution.windowloc(window)[0..1]
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
def self.resize(width,height,center = true)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
if center
Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1)
else
x,y = Resolution.windowloc(window)[2..3]
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
end
def self.half(center = true)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
if center
Resolution::MoveWindow.call(window,(screenwidth - 326) / 2,(screenheight - 272) / 2,326,272,1)
else
x,y = Resolution.windowloc(window)[2..3]
Resolution::MoveWindow.call(window,x,y,326,272,1)
end
end
def self.default
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,(screenwidth - 646) / 2,(screenheight / 2) - 273,646,512,1)
end
end
#Screen.resize($width + 6,$height + 28)
class PokemonLoadScene
def pbStartScene
case $PokemonSystem.screensize
when 0
Screen.resize(240 + 6,330 + 28)
$spacer=IconSprite.new(0, 160)
when 1
Screen.resize(480 + 6,660 + 28)
$spacer=IconSprite.new(0, 320)
end
$spacer.setBitmap("Graphics/Pictures/spacer")
$spacer.z = 9999998
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
addBackgroundOrColoredPlane(@sprites,"clrvp","loadbg",
Color.new(17<<3,18<<3,31<<3),@viewport)
@sprites["locwindow"]=Window_AdvancedTextPokemon.new("")
@sprites["locwindow"].viewport=@viewport
@sprites["locwindow"].visible=false
@sprites["cmdwindow"]=Window_CommandPokemon.new([])
@sprites["cmdwindow"].x=0
@sprites["cmdwindow"].y=0
@sprites["cmdwindow"].viewport=@viewport
@sprites["cmdwindow"].visible=false
pbFadeInAndShow(@sprites) { pbUpdate }
end
end
class PokemonOptionScene
def pbStartScene
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["title"]=Window_UnformattedTextPokemon.newWithSize(
_INTL("OPTION"),0,0,Graphics.width,64,@viewport)
# These are the different options in the game. To add an option, define a setter and
# a getter for that option. To delete an option, comment it out or delete it.
# The game's options may be placed in any order.
@PokemonOptions=[
EnumOption.new(_INTL("TEXT SPEED"),[_INTL("SLOW"),_INTL("MID"),_INTL("FAST")],
proc { $PokemonSystem.textspeed }, # Getter
proc {|value|
$PokemonSystem.textspeed=value
MessageConfig.pbSetTextSpeed(pbSettingToTextSpeed(value))
} # Setter
),
EnumOption.new(_INTL("BATTLE SCENE"),[_INTL("ON"),_INTL("OFF")],
proc { $PokemonSystem.battlescene },
proc {|value| $PokemonSystem.battlescene=value }
),
EnumOption.new(_INTL("BATTLE STYLE"),[_INTL("SHIFT"),_INTL("SET")],
proc { $PokemonSystem.battlestyle },
proc {|value| $PokemonSystem.battlestyle=value }
),
EnumOption.new(_INTL("FONT STYLE"),[_INTL("Em"),_INTL("R/S"),_INTL("FRLG"),_INTL("DP")],
proc { $PokemonSystem.font },
proc {|value|
$PokemonSystem.font=value
MessageConfig.pbSetSystemFontName($VersionStyles[value])
}
),
NumberOption.new(_INTL("FRAME"),_INTL("TYPE%d"),1,$TextFrames.length,
proc { $PokemonSystem.frame },
proc {|value|
$PokemonSystem.frame=value
MessageConfig.pbSetSystemFrame($TextFrames[value])
}
),
EnumOption2.new(_INTL("SCREEN SIZE"),[_INTL("240x160"),_INTL("480x320")],#,_INTL("320x240"),_INTL("640x480")],
proc { $PokemonSystem.screensize },
proc {|value|
oldvalue=$PokemonSystem.screensize
$PokemonSystem.screensize=value
$ResizeOffsetX=[0,0,80,80][value]
$ResizeOffsetY=[0,0,80,80][value]
pbSetResizeFactor([0.5,1.0,0.5,1.0][value])
case value
when 0
Screen.resize(240 + 6,330 + 28)
when 1
Screen.resize(480 + 6,660 + 28)
end
if value!=oldvalue
ObjectSpace.each_object(TilemapLoader){|o| next if o.disposed?; o.updateClass }
# Screen size (0=240x160, 1=480x320, 2=320x240, 3=640x480)
end
}
),
EnumOption2.new(_INTL("MAP VIEW"),[_INTL("ORIGINAL"),_INTL("CUSTOM"),_INTL("PERSPECTIVE")],
proc { $PokemonSystem.tilemap ? $PokemonSystem.tilemap : 0 },
proc {|value|
oldvalue=$PokemonSystem.tilemap
$PokemonSystem.tilemap=value
if value!=oldvalue
ObjectSpace.each_object(TilemapLoader){|o| next if o.disposed?; o.updateClass }
end
}
),
NumberOption.new(_INTL("SPEECH FRAME"),_INTL("TYPE%d"),1,$SpeechFrames.length,
proc { $PokemonSystem.textskin },
proc {|value| $PokemonSystem.textskin=value;
MessageConfig.pbSetSpeechFrame(
"Graphics/Windowskins/"+$SpeechFrames[value]) }
)
]
@sprites["option"]=Window_PokemonOption.new(@PokemonOptions,0,
@sprites["title"].height,Graphics.width,
[email]Graphics.height-@sprites["title"].height[/email]ht)
@sprites["option"].viewport=@viewport
@sprites["option"].visible=true
# Get the values of each option
for i in [email protected]
@sprites["option"][i]=(@PokemonOptions[i].get || 0)
end
pbDeactivateWindows(@sprites)
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbEndScene
pbFadeOutAndHide(@sprites) { pbUpdate }
# Set the values of each option
for i in [email protected]
@PokemonOptions[i].set(@sprites["option"][i])
end
case $PokemonSystem.screensize
when 0
Screen.resize(240 + 6,330 + 28)
$spacer.y = 160
when 1
Screen.resize(480 + 6,660 + 28)
$spacer.y = 320
end
pbDisposeSpriteHash(@sprites)
pbRefreshSceneMap
@viewport.dispose
end
end
if USE_MOUSE
class MouseSprite
def initialize
@mouse = IconSprite.new
@mouse.setBitmap("Graphics/Pictures/Mouse")
@mouse.z = 9999999
#@mouse.zoom_x = 2
#@mouse.zoom_y = 2
end
def self.x
return @mouse.x
end
def self.y
return @mouse.y
end
def update
case $PokemonSystem.screensize
when 0
@mouse.x = Mouse.pos_x * 2
@mouse.y = Mouse.pos_y * 2
when 1
@mouse.x = Mouse.pos_x
@mouse.y = Mouse.pos_y
when 2
@mouse.x = Mouse.pos_x
@mouse.y = Mouse.pos_y
when 3
@mouse.x = Mouse.pos_x
@mouse.y = Mouse.pos_y
end
end
def cursor(filename)
@mouse.setBitmap("Graphics/Pictures/" + filename)
end
def opacity(opacity)
@mouse.opacity = opacity
end
def defaults
@mouse.setBitmap("Graphics/Pictures/Mouse")
@mouse.opacity = 255
@mouse.zoom_x = 2
@mouse.zoom_y = 2
end
end
module Mouse
$mouse=MouseSprite.new
@cursor_pos_get = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
@cursor_pos_set = Win32API.new('user32', 'SetCursorPos', 'ii', 'i')
@cursor_show = Win32API.new('user32', 'ShowCursor', 'L', 'i')
@window_find = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
@window_c_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
@window_scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
@readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
@key = Win32API.new("user32", "GetAsyncKeyState", 'i', 'i')
Left_Click = 1
Right_Click = 2
Middle_Click = 4
MOUSE_BUTTONS = { Left_Click => 1,
Right_Click => 2,
Middle_Click => 4 }
MOUSE_REPEAT = MOUSE_BUTTONS.clone
MOUSE_REPEAT.keys.each { |k| MOUSE_REPEAT[k] = [false, false, 10]}
@game_window = nil # Set game handle to nil
@cursor_show.call(0) # Turn off system mouse
def Mouse.click?(button)
MOUSE_REPEAT[button][1] >= 1
end
def Mouse.dbclick?(button)
MOUSE_REPEAT[button][1] == 2
end
def Mouse.pos(catch_anywhere = true)
x, y = screen_to_client(screen_x, screen_y)
width, height = client_size
if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height)
return x, y
else
return 0, 0
end
end
def Mouse.pos_set(x, y)
x = [[x, 0].max, 640].min
y = [[y, 0].max, 480].min
x, y = client_to_screen(x, y)
@cursor_pos_set.call(x, y)
end
def Mouse.pos_x
x, y = pos
return x
end
def Mouse.pos_y
x, y = pos
return y
end
def Mouse.screen
pos = [0, 0].pack('ll')
@cursor_pos_get.call(pos)
return pos.unpack('ll')
end
def Mouse.screen_x
pos = [0, 0].pack('ll')
@cursor_pos_get.call(pos)
return pos.unpack('ll')[0]
end
def Mouse.screen_y
pos = [0, 0].pack('ll')
@cursor_pos_get.call(pos)
return pos.unpack('ll')[1]
end
def Mouse.client_size
rect = [0, 0, 0, 0].pack('l4')
@window_c_rect.call(Mouse.hwnd, rect)
right, bottom = rect.unpack('l4')[2..3]
return right, bottom
end
def Mouse.hwnd
if @game_window.nil?
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
@game_window = @window_find.call('RGSS Player',game_name)
end
return @game_window
end
def Mouse.screen_to_client(x, y)
return nil unless x and y
pos = [x, y].pack('ll')
if @window_scr2cli.call(hwnd, pos) != 0
return pos.unpack('ll')
else
return nil
end
end
def Mouse.update
$mouse.update
MOUSE_BUTTONS.keys.each do |key|
temp = MOUSE_REPEAT[key][0]
key_pres = @key.call(MOUSE_BUTTONS[key]) != 0
key_trig = temp == key_pres ? 0 : (key_pres ? (MOUSE_REPEAT[key][2].between?(1, 9) ? 2 : 1) : -1)
count = key_trig > 0 ? 0 : [MOUSE_REPEAT[key][2]+1, 20].min
MOUSE_REPEAT[key] = [key_pres, key_trig, count]
end
end
def Mouse.visible?(visible=true)
if visible
@cursor_show.call(-1)
else
@cursor_show.call(0)
end
end
def Mouse.mouse_in_area?(*args)
return false if Mouse.pos_x.nil?
if args[0].is_a?(Rect)
Mouse.pos_x >= args[0].x and
Mouse.pos_y >= args[0].y and
Mouse.pos_x <= args[0].x + args[0].width and
Mouse.pos_y <= args[0].y + args[0].height
else
Mouse.pos_x >= args[0] and
Mouse.pos_y >= args[1] and
Mouse.pos_x <= args[0] + args[2] and
Mouse.pos_y <= args[1] + args[3]
end
end
end
module Input
class << self
alias cng_input_update update
def update
cng_input_update
Mouse.update
end
end
end
end
I am using the latest Mouse module, and I have the September 5th release of essentials. I get this error:
"Script 'Dual Screen' line 192: SyntaxError occured."
Line 192 is
PHP:
[email]Graphics.height-@sprites["title"].height[/email]ht)