Ruby Popup Editor
Version: 1.0
Introduction
Now you can set a variable or a switch, call a class...
Now you can encode in ruby directly in the rgss player, currently playing with a popup
Screenshots
Demo
non
Script
Instructions
place it above main
FAQ
Press F5 to show/hide the popup
Compatibility
no conflict, I believe
Credits and Thanks
msdn, for WIN32Apis
Terms and Conditions
Free, but Credits are needed !
Version: 1.0
Introduction
Now you can set a variable or a switch, call a class...
Now you can encode in ruby directly in the rgss player, currently playing with a popup
Screenshots

Demo
non
Script
Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Editeur Ruby pour RMVX v.2.2
# berka  http://www.rpgmakervx-fr.com
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# touche F5 pour afficher ou masquer la console
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Getkeystate=Win32API.new("user32","GetAsyncKeyState",'i','i')
class Editeur
 def initialize
@text=[]
@getprivatestring=Win32API.new('kernel32','GetPrivateProfileString','pppplp','l')
@findwindow=Win32API.new('user32','FindWindow',%w(p p),'i')
@createwindow=Win32API.new("user32","CreateWindowEx",'lpplllllllll','l')
@showwindow=Win32API.new('user32','ShowWindow',%w(l l),'l')
@destroywindow=Win32API.new('user32','DestroyWindow','p','l')
@iswindow=Win32API.new('user32','IsWindow','p','l')
@getwindowtext=Win32API.new('user32','GetWindowText',%w(n p n ),'l')
@dim_ecran=Win32API.new('user32','GetSystemMetrics','i','i')
@getwindowrect=Win32API.new('user32','GetWindowRect',%w(l p),'i')
@updatewindow=Win32API.new('user32','UpdateWindow','p','i')
@setwindowtext=Win32API.new('user32','SetWindowText',%w(p p),'i')
 end
 def handle
title="\0"*256
@getprivatestring.call("Game","Title","",title,256,".//Game.ini")
title.delete!("\0")
return @findwindow.call("RGSS Player",title)
 end
 def start
(fermer_fen;return) if !@fen.nil?
fenetre
loop do
 Graphics.update
 update
 break if Getkeystate.call(0x0D)&0x01==1
 return if Getkeystate.call(0x74)&0x01==1
end
if !@fen.nil?
 eval(recup_text) rescue (
 Exception
 msg="Type d'Erreur:\n\t#{$!.class}\n\n"
 line=$!.message[7,1].to_i
 msg+="Numéro de ligne de l'Erreur:\n\t#{line}\n\n"
 lines=recup_text.split(/\n/)
 msg+="Ligne de l'Erreur:\n\t#{lines[(line-1)]}\n\n"
 msg+="Script exécuté:\n\t#{recup_text}"
 print(msg))
end
fermer_fen
 end
 def fenetre(t="",x=dim[0],y=dim[3],w=dim[2]-x,h=24)
@fen=@createwindow.call((0x00000100|0x00000200),"edit",t,(
(0x4000000|0x80000000|0)|0x02000000),x,y,w,h,handle,0,0,0)
aff_fen
 end
 def aff_fen(bool=true);bool ? @showwindow.call(@fen,1) : @showwindow.call(@fen,0);end Â
 def dims_ecran;return @dim_ecran.call(0),@dim_ecran.call(1);end
 def update;@updatewindow.call(@fen);end
 def fermer_fen;@destroywindow.call(@fen);@fen=nil;end
 def ajouter_text;@setwindowtext.call(@fen,@text.to_s);end
 def fenetre?
(return false) if @fen.nil?
@iswindow.call(@fen)==0 ? (return false):(return true)
 end
 def recup_text
res=" "*255
@getwindowtext.call(@fen,res,0x3e80) rescue nil
return res
 end
 def dim
rect=[0,0,0,0].pack('l4')
@getwindowrect.call(handle,rect)
x,y,w,h=rect.unpack('l4')
return x,y,w,h
 end
end
$editeur=Editeur.new
module Input
 class << self
  if @update_aliased.nil?
   alias :update_alias :update
   def update
    $editeur.start if Getkeystate.call(0x74)&0x01==1
    update_alias if !$editeur.fenetre? rescue update_alias
   end
   @update_aliased = true
  end
 end
end
Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#Â Â Â Â Â Â Editeur Ruby pour RMXP
# berka               http://www.rpgmakervx-fr.com
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# touche F5 pour afficher ou masquer la console
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Getkeystate=Win32API.new("user32","GetAsyncKeyState",'i','i') #api clavier
class Editeur
 def initialize
  @text=[] #tableaux de chaines pour la fonction ajouter_text
  @getprivatestring=Win32API.new('kernel32','GetPrivateProfileString','pppplp','l') #extraction string fichier
  @findwindow=Win32API.new('user32','FindWindow',%w(p p),'i') # recherche de fenetre, renvoie handle
  @createwindow=Win32API.new("user32","CreateWindowEx",'lpplllllllll','l') # creation fenetre renvoie handle
  @showwindow=Win32API.new('user32','ShowWindow',%w(l l),'l') # affichage fenetre selon handle
  @destroywindow=Win32API.new('user32','DestroyWindow','p','l') # destruction (complete) de fenetre selon handle
  @iswindow=Win32API.new('user32','IsWindow','p','l') # la fenetre existe ? selon handle
  @getwindowtext=Win32API.new('user32','GetWindowText',%w(n p n ),'l') # recupere texte fenetre selon handle
  @dim_ecran=Win32API.new('user32','GetSystemMetrics','i','i') # renvoie dimensions ecran
  @getwindowrect=Win32API.new('user32','GetWindowRect',%w(l p),'i') # renvoie dimensions fenetre selon handle
  @updatewindow=Win32API.new('user32','UpdateWindow','p','i') # raffraichissement fenetre selon handle
  @setwindowtext=Win32API.new('user32','SetWindowText',%w(p p),'i') # ecriture de chaine dans fenetre selon handle
 end
 def handle
  title="\0"*256 # creation d'une chaine vide de 256 caracteres
  @getprivatestring.call("Game","Title","",title,256,".//Game.ini") #lecture de game.ini, recupération du titre du player
  title.delete!("\0") # suppression du "vide" de la chaine
  return @findwindow.call("RGSS Player",title) # acquisition et retour du handle du player selon titre
 end
 def start # methode de lancement de la popup
  (fermer_fen;return) if !@fen.nil? # on ferme la fenetre si son handle existe et retour
  fenetre # creation de la fenetre de popup
  loop do # boucle de maj
   Graphics.update # maj graphics, pour eviter la fermeture du player
   update # maj de la popup
   break if Getkeystate.call(0x0D)&0x01==1 # sortie si touche Enter pressée
   return if Getkeystate.call(0x74)&0x01==1 # retour si la touche F5 pressée
  end
  if !@fen.nil? # si le handle de la popup existe
   eval(recup_text) rescue ( # on execute en ruby son contenu, en cas d'erreur...
   Exception # appel de la procedure d'exception
   msg="Type d'Erreur:\n\t#{$!.class}\n\n" #creation du message << la classe
   line=$!.message[7,1].to_i # decoupage du message recu de Exception <<
   msg+="Numéro de ligne de l'Erreur:\n\t#{line}\n\n" # ajout du n°de ligne d'erreur
   lines=recup_text.split(/\n/)
   msg+="Ligne de l'Erreur:\n\t#{lines[(line-1)]}\n\n"
   msg+="Script exécuté:\n\t#{recup_text}"
   print(msg)) # affichage du message
  end
  fermer_fen # et on ferme la popup
 end
 def fenetre(t="",x=dim[0],y=dim[3],w=dim[2]-x,h=24) # params de positionnement
  @fen=@createwindow.call((0x00000100|0x00000200), # @fen=handle popup
  "edit",t,((0x4000000|0x80000000|0)|0x02000000), # editable, texte,(pos curseur...),popup
  x,y,w,h,handle,0,0,0) # position et assignation de la popup comme fille du player
  aff_fen # affichage de la popup
 end
 def aff_fen(bool=true);bool ? @showwindow.call(@fen,1) : @showwindow.call(@fen,0);end #affiche si masquée et inversement
 def dims_ecran;return @dim_ecran.call(0),@dim_ecran.call(1);end # renvoie w/h du player
 def update;@updatewindow.call(@fen);end # maj fenetre de handle @fen (popup)
 def fermer_fen;@destroywindow.call(@fen);@fen=nil;end # destruction fenetre de handle @fen (popup)
 def ajouter_text;@setwindowtext.call(@fen,@text.to_s);end # fonction ajouter text dans popup
 def fenetre? # la fenetre existe ?
  (return false) if @fen.nil? # renvoi non si pas de handle
  @iswindow.call(@fen)==0 ? (return false):(return true) # true si le handle==popup
 end
 def recup_text # recuperation texte de la popup
  res=" "*256 # creation chaine vide de 256 caracteres
  @getwindowtext.call(@fen,res,0x3e80) rescue nil # extraction du contenu vers res
  return res # renvoie res
 end
 def dim # dimensions du player
  rect=[0,0,0,0].pack('l4') # creation et compactage d'un tableau à4 entrees
  @getwindowrect.call(handle,rect) # extration des dims du player (handle) vers rect
  x,y,w,h=rect.unpack('l4') # decompactage de rect vers x,y,w,h
  return x,y,w,h # renvoi des 4 dimensions
 end
end
class Scene_Title
 alias editeur_main main
 def main
  $editeur=Editeur.new # creation de l'instance de Editeur
  editeur_main
 end
end
module Input # merci krosk !
 class << self
  if @update_aliased.nil?
   alias :update_alias :update
   def update
    $editeur.start if Getkeystate.call(0x74)&0x01==1 && $DEBUG
    update_alias if !$editeur.fenetre? rescue update_alias
   end
   @update_aliased = true
  end
 end
end
Instructions
place it above main
FAQ
Press F5 to show/hide the popup
Compatibility
no conflict, I believe
Credits and Thanks
msdn, for WIN32Apis
Terms and Conditions
Free, but Credits are needed !