Sujet n°11900
Posté par Dark_Ray le 15 Aoû - 16:52 (2012)
Titre : Besoin d'un coup de pouce pour un script [RESOLU]
Bonjour, Bonsoir,

Voilà je voudrais modifier mon script Pokemon_Save, et pour cela il faut que j'écrive en des phrases en noires !

En bidouillant par-ci par là j'ai réussi à mettre la phrase avec Draw_Text mais impossible de lui mettre une autre couleur que blanc, cela fait que le message est illisible :/


Voilà la portion que j'ai modifié :

Pokemon_Save modifié
def draw_choice
@command = Window_Command.new(120, ["OUI", "NON"], $fontsizebig)
@command.x = 517
@command.y = 359
loop do
Graphics.update
Input.update
@command.update
if Input.trigger?(Input::C) and @command.index == 0

#Test
@text_window = Window_Base.new(4, 340, 632, 136)
@text_window.opacity = 255
@text_window.z = 1
@text_window.contents = Bitmap.new(600 + 32, 104 + 32)
@text_window.contents.font.color = Color.new(64,144,208,255)
@text_window.contents.font.name = $fontface
@text_window.contents.font.size = $fontsizebig

def draw_text(line1 = "", line2 = "")
if line1.type == Array
if line1[1] != nil
draw_text(line1[0], line1[1])
else
draw_text(line1[0])
end
else
Graphics.freeze
@text_window.contents.clear
@text_window.draw_text(12, 0, 460, 50, line1)
@text_window.draw_text(12, 55, 460, 50, line2)
Graphics.transition(5)
end
end

def wait(frame)
i = 0
loop do
i += 1
Graphics.update
if i >= frame
break
end
end
end

wait(5)
draw_text("Votre partie a bien été sauvegardé")
Audio.se_play("Audio/SE/save.wav", 100)
wait(80)
@command.dispose
@command = nil
Input.update
return true
end
if Input.trigger?(Input::C) and @command.index == 1
@command.dispose
@command = nil
Input.update
return false
end
end
end



Merci d'avance Clin d'œil foireux

Posté par Nuri Yuri le 15 Aoû - 17:29 (2012)
Ah les fameuses window, essaie : @text_window.draw_text(12, 0, 460, 50, line1,0,Color.new(64,144,208,255)).

Posté par Dark_Ray le 15 Aoû - 17:42 (2012)
Merci ça marche nickel :D
Mais l'ombre derrière le texte peut-elle être supprimée ?

Posté par Nuri Yuri le 15 Aoû - 18:04 (2012)
Vas dans Window_Base et trafique un peu le code de draw_text.

Posté par Dark_Ray le 15 Aoû - 18:11 (2012)
Lequel de Window_Base j'en ai 2 ^^

Posté par Nuri Yuri le 15 Aoû - 18:39 (2012)
Le dernier.

Posté par Dark_Ray le 15 Aoû - 19:04 (2012)
J'ai essayé de modifier le code de Draw_Text dans Window_Base

def draw_text(x, y, w, h, string, align = 0, color = white)
self.contents.font.color = Color.new(96,96,96,175)
self.contents.draw_text(x + 3, y + 3, w, h, string, align)
self.contents.font.color = color
self.contents.draw_text(x, y, w, h, string, align)
end

Mais rien ne change, j'ai d'abord mis en commentaire les 2 premières lignes puis inversement mais rien n'y fait ...
Je suis complètement largué malheureusement :/

PS: j'ai copié celui de base, pas celui que j'ai modifié

Posté par Nuri Yuri le 15 Aoû - 20:08 (2012)
Code:
def draw_text(x, y, w, h, string, align = 0, color = white,color2=Color.new(96,96,96,175))
 self.contents.font.color = color2
 self.contents.draw_text(x + 3, y + 3, w, h, string, align)
 self.contents.font.color = color
 self.contents.draw_text(x, y, w, h, string, align)
 end

@text_window.draw_text(12, 0, 460, 50, line1,0,Color.new(64,144,208,255),Color.new(0,0,0,0))

Posté par Dark_Ray le 15 Aoû - 20:25 (2012)
Maintenant que j'ai copié le script voilà ce que je reçois :

---------- Erreur de script : Message_Pokemon ----------
----- Type
TypeError

----- Message
Color can't be coerced into Fixnum

----- Position dans Message_Pokemon
Ligne 180

----- Backtrace
Script : Message_Pokemon | Ligne : 180 | Méthode : in `+'
Script : Message_Pokemon | Ligne : 180 | Méthode : in `draw_text'
Script : Pokemon_Save | Ligne : 327 | Méthode : in `draw_text'
Script : Pokemon_Save | Ligne : 345 | Méthode : in `draw_choice'
Script : Pokemon_Save | Ligne : 302 | Méthode : in `loop'
Script : Pokemon_Save | Ligne : 360 | Méthode : in `draw_choice'
Script : Pokemon_Save | Ligne : 127 | Méthode : in `update'
Script : Pokemon_Save | Ligne : 81 | Méthode : in `main'
Script : Pokemon_Save | Ligne : 78 | Méthode : in `loop'
Script : Pokemon_Save | Ligne : 85 | Méthode : in `main'
Script : Main | Ligne : 57

Posté par Nuri Yuri le 15 Aoû - 20:32 (2012)
heu, ce bug est totalement anormal, je me demande comment x a pu se transformer en une couleur...
Remet l'ancienne, copie la et met un autre nom, tu utiliseras celle-ci, et tu supprimera les lignes qui affiche l'ombre.

Posté par Dark_Ray le 15 Aoû - 21:20 (2012)
Ca marche !

Merci de ton aide Clin d'œil foireux