• Anmelden

Ventus

Rekrut

  • »Ventus« ist der Autor dieses Themas

Motto: 目は心の鏡。

  • Nachricht senden

1

Sonntag, 19. Oktober 2008, 18:00

Questlog 3.0 Frage

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
#//////////////////////////////////Questlog 3.0/////////////////////////////////
#~~~~~~~~~~~~~~~~~~by Caesar~~~~~~~~~~~~~~~~~
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#Questlog aufrufen:
#$scene = Scene_Questlog.new
#Quest hinzufügen:
#Questlog.add("Titel", "Beschreibung")
#Quest entfernen:
#Questlog.remove("Titel")
#==================================================================
=begin
● <br>
Zeilenumbruch
● <b>Text</b>
Fetter Text
● <i>Text</i>
Kursiver Text
● <u>Text</u>
Unterstrichener Text
● <color=X>Text</color>
Farbiger Text
a) Ein Farbcode in Hexadezimalschreibweise mit vorangestelltem #, 
z.B. #ffffff = weiß. Die
gleichen Farbcodes können in HTML bzw. CSS verwendet werden, 
daher gibt es im Internet viele Farbtabellen für diese Hexcodes.
b) Ein Farbwort, dabei sind folgende möglich: normal_color (weiß), 
system_color (blau), disabled_color (grau), crisis_color (gelb), 
knockout_color (rot), white, black, red, green, blue, yellow, cyan, 
magenta, light_gray, gray, dark_gray, pink, orange.
c) Ein Message-Farbcode, der auch beim Messagecode \c[X] verwendet wird, 
also eine Zahl von 0-7.
● <size=X>Text</size>
Der Text wird in der angegebenen Schriftgröße dargestellt.
● <small>Text</small>
Kleinerer Text
● <big>Text</big>
Größerer Text
● <font=X>Text</font>
Der Text wird in der angegebenen Schriftart dargestellt.
● <shadow>Text</shadow>
Der Text wirft einen Schatten.
● <icon=X>
Ein Icon wird (innerhalb der Zeile) gezeichnet. Für X ist der 
Name des (importierten) Icons
einzusetzen.
● <image=X>
Ein Bild wird zentriert in einer neuen Zeile gezeichnet. 
Für X ist der Name des (importierten)
Bildes einzusetzen.
● <line>
Zeichnet eine Trennlinie, entspricht <hr> aus HTML.
● <down=X>
Wie Zeilenumbruch, aber Zeilenabstand ist einstellbar. 
Für X ist der vertikale Versatz in Pixeln
einzusetzen.
● <space=X>
Lässt eine (horizontale) Lücke von X Pixeln. Z.B. für Einrückung am 
Zeilenanfang zu gebrauchen.
● <if=X>Text<else>Anderer Text</if>
Schalterabhängiger Text. Für X ist die ID eines Switches einzusetzen. 
Wenn der Switch an ist, wird „Text“ dargestellt, ansonsten der „Andere Text“.
● <var=X>
Wert der Variable mit der ID X.
● <eval={X}>
Hiermit kann beliebiger RGSS-Code eingebettet werden, der erst zum Zeitpunkt der Darstellung
evaluiert wird. Die Tags <if> und <var> sind im Grunde nur Spezialformen dieser dynamischen
Inhaltserzeugung. Mit dem Eval-Tag können so spezielle Variablen wie Heldennamen, Statuswerte
und Systemvariablen eingebunden werden.
● <style=X>Text</style>
Eines der wichtigsten Tags: das Style-Tag. Wie schon bei den Parametern beschrieben, werden die
konkreten Formatierungen idealerweise zentral (bei den Parametern) definiert und die Dokumente
semantisch getaggt. Dieses Semantische Tagging geschieht durch den Style-Tag. Für X ist der
Name des Styles einzusetzen, der natürlich im Styles-Parameter definiert sein muss.
=end
#===================Parameter==================
# Wenn true, werden neue Quests oben eingefügt, ansonsten unten
INSERT_AT_TOP = true
# Zeilenhöhe in der Questbeschreibung
LINE_HEIGHT = 24
# Windowskin der Questlog-Fenster (nil = default)
WINDOWSKIN = nil
# "Überschrift" des Questlogs
HEADER_TEXT = "Questbrett"
# Geschwindigkeit beim Scrollen (Pixel / Frame)
SCROLL_SPEED = 7
# Styles für die Beschreibungen der Quests
STYLES = {
"h1" => "<size=45><font=Cambria><b>|</b></font></size><down=40>",
"h2" => "<big><b><font=Cambria>|</font></b></big><down=32>",
"disabled" => "<color=disabled_color>|</color>",
"highlight" => "<color=#eeee32>|</color>",
"system" => "<color=system_color>|</color>"
}
# Dieser Process wird ausgeführt, sobald das Questlog geschlossen wird;
# (Default: Spieler kommt wieder auf die Map)
ON_CLOSE = Proc.new {$scene = Scene_Map.new}
#============================================
class Scene_Questlog
def main
@window_header = Window_Help.new
@window_header.x = 65
@window_header.y = 28
@window_header.z = 500
@window_header.width = 510
@window_header.windowskin = RPG::Cache.windowskin(WINDOWSKIN) unless
WINDOWSKIN.nil?
@window_header.contents = Bitmap.new(478, 32)
@window_header.contents.font.size = 30
@window_header.contents.draw_text(0, 0, 510, 32, HEADER_TEXT, 1)
@window_titles = Window_Questlog_Titles.new
@window_titles.windowskin = RPG::Cache.windowskin(WINDOWSKIN) unless
WINDOWSKIN.nil?
@window_description = Window_Questlog_Description.new(
$game_system.questlog.quests.map{|q| q.description})
@window_description.windowskin = RPG::Cache.windowskin(WINDOWSKIN) unless
WINDOWSKIN.nil?
@index = @window_titles.index
spriteset = Spriteset_Map.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_header.dispose
@window_titles.dispose
@window_description.dispose
spriteset.dispose
end
#----------------
def update
@window_titles.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
ON_CLOSE.call
return
end
if Input.press?(Input::R)
@window_description.scroll_down
elsif Input.press?(Input::L)
@window_description.scroll_up
end
if @index != @window_titles.index
@window_description.index = @index = @window_titles.index
end
end
end
#=============
class Quest
attr_reader :title
attr_reader :description
def initialize(title, description)
@title = title
@description = description
end
end
#============
class Questlog
attr_reader :quests
def initialize
@quests = []
end
#-----------
def add(quest, description="")
return add(Quest.new(quest, description)) unless quest.is_a?(Quest)
i = index(quest.title)
return @quests[i] = quest if i != nil
if INSERT_AT_TOP
# insert quest at top of the list
@quests.unshift(quest)
else
# insert quest at bottom of the list
@quests.push(quest)
end
end
#-----------
def remove(title)
@quests.delete_if{ |quest| quest.title == title}
end
#-----------
def count
return @quests.length
end
#------------
def index(title)
for i in 0..@quests.length-1
return i if @quests[i].title == title
end
return nil
end
#------------
def Questlog.add(title, description="")
$game_system.questlog.add(title, description)
end
#------------
def Questlog.remove(title)
$game_system.questlog.remove(title)
end
end
#=============
class Window_Questlog_Description < Window_Base
attr_reader :index
#------------------
def initialize(descriptions)
super(275, 92, 300, 360)
@descriptions = descriptions
@cache = Array.new(descriptions.size)
self.contents = Bitmap.new(width-32, height-32)
self.index = 0
self.z = 500
end
#-----------
def index=(index)
return if index == @index or @descriptions.empty?
@index = index
self.oy = 0
# bitmaps are only rendered once and than cached to reach more efficiency
if @cache[index].nil?
buffer = Bitmap.new(width-32, 2000)
docheight = buffer.draw_html(0, 0, 270, 2000, @descriptions[index])
@cache[index] = self.contents = Bitmap.new(width-32, docheight)
self.contents.blt(0, 0, buffer, Rect.new(0, 0, self.width-32, docheight))
else
self.contents = @cache[index]
end
end
#-----------
def scroll_down
self.oy += SCROLL_SPEED if self.height + self.oy - 32 < self.contents.height
end
#------------
def scroll_up
self.oy -= SCROLL_SPEED
self.oy = 0 if self.oy < 0
end
end
#=============
class Window_Questlog_Titles < Window_Base
attr_reader :index
def initialize
super(65, 92, 210, 360)
self.z = 500
@item_max = $game_system.questlog.count
self.contents = Bitmap.new(width-32, @item_max > 0 ? @item_max*32 : 32)
@index = 0
refresh
end
#-------------
def index=(index)
@index = index
update_cursor_rect
end
#-------------
def top_row=(row)
if row < 0
row = 0
end
if row > @item_max - 1
row = @item_max - 1
end
self.oy = row * 32
end
#-------------
def page_row_max
return (self.height - 32) / 32
end
#-------------
def page_item_max
return page_row_max * @column_max
end
#-------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index
top_row = self.oy / 32
if row < top_row
self.top_row = row
end
if row > top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
self.cursor_rect.set(0, @index * 32 - self.oy, self.width - 32, 32)
end
#-------------
def refresh
self.contents.clear
for i in 0...$game_system.questlog.count
quest = $game_system.questlog.quests[i]
y = i*32
self.contents.draw_html(4, y, 150, 32, quest.title)
end
end
#------------
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::DOWN) and
(Input.trigger?(Input::DOWN) or @index < @item_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % @item_max
end
if Input.repeat?(Input::UP) and
(Input.trigger?(Input::UP) or @index > 0)
$game_system.se_play($data_system.cursor_se)
@index = (@index - 1 + @item_max) % @item_max
end
end
update_cursor_rect
end
end
#===========
class Scene_Map
def call_questlog
$game_temp.questlog_calling = false
$game_player.straighten
$scene = Scene_Questlog.new
end
end
#===========
class Game_System
attr_accessor :questlog
alias questlog_init initialize
def initialize
questlog_init
@questlog = Questlog.new
end
end
#===========
class Game_Temp
attr_accessor :questlog_calling
alias questlog_init initialize
def initialize
questlog_init
@questlog_calling = false
end
end
#========================
class Scene_Load < Scene_File
# if a game that does not yet contain the questlog is loaded
# a new (empty) questlog instance is created
alias questlog_read_save_data read_save_data
def read_save_data(file)
questlog_read_save_data(file)
$game_system.questlog = Questlog.new if $game_system.questlog.nil?
end
end

So,hier ist schonmal der Script!So,jetzt will ich wissen,ob es möglich ist,in dem man sich den Quest an guckt ein Tab(Switch) aktivieren lässt!Soll heißen.Ichschaue mir den Quest im Questlog an!Wenn ich nun den Questlog wegdrücke aktivieren sich alle Tabs,die aktiviert werden sollen.Falls das schlecht erklärt ist,bitte schreibt es hierhin und ich schaue ob ich ein b#Beispiel findfe.Es wäre aber sehr wichtig!

Hab den Doppelthread mal entfernt. ~Monsta

Social Bookmarks