• Anmelden

1

Mittwoch, 23. September 2009, 17:18

Zeichenfehler im Text

Hi Ich habe ein Problem mit nem Script, ich benutze das HTML-Rendering-Engine von Caesar. Nun wird jedes mal wenn ich einen Text mit einem dieser HTML Tags formatiere ein Quadrat für die Tags dargestellt, ich habe das Script auch mal im XP getestet und habe festgestellt das dort kein Quadrat erscheinen. Weiß jemand wie ich diese Quadrate wegbekomme und warum sie im VX erscheinen aber im XP nicht?

Spoiler: Callscript

Ruby Quellcode

1
Quest.add("Quest 1", "<b>Inhalt 1</b>")
zum Lesen den Text mit der Maus markieren

Spoiler: Script

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
# Orginal von Caesar (Questlog V3  07.08.2008)
LINE_HEIGHT = 32 # Zeilenhöhe in der Questbeschreibung 
################################################################################
module QUEST_MODULE
  $quest_name = []
  $quest_inhalt = []
  $quest_data = []
  $quest_data[1] = 0
  $quest_data[2] = 0
end
################################################################################
class Quest
 
  def Quest.add(titel="", inhalt="")  
    inhalt.gsub(//,'')
    $quest_name.unshift( titel )
    $quest_inhalt.unshift( inhalt.gsub(/\n/,'') )
    $quest_data[2] += 1
  end
end
########################### Menü ###############################################
class Quest_Menue
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @sprite_set = Spriteset_Map.new
  end
 
  def main
    @header = Window_Help.new
    @header.width = 545
    @header.height = 65 
    @header.contents = Bitmap.new(478, 32) 
    @header.back_opacity = 160
    @header.contents.font.size = 30 
    @header.contents.font.name = "Arial"
    @header.contents.draw_text(0, 0, 510, 32, "Abenteuerbuch", 1) 
    command = []
    if $quest_data[2] > 0
      command.delete( "No Quest" )
      for i in 0..$quest_name.size-1 
        command.push( $quest_name[i] )
      end
    else
      command.push( "No Quest" )
    end
    @command_window = Window_Command.new(180, command)
    @command_window.index = @menu_index
    @command_window.back_opacity = 160
    @command_window.y = 65
    @command_window.width = 180
    @command_window.height = 350
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @header.dispose
  end
 
  def update
    @command_window.update
    if @command_window.active
      update_command
      return
    end
  end
 
  def update_command
    if Input.trigger?(Input::C)
      for z in 0..$quest_data[2]
        $quest_data[1] = z if @command_window.index == z
      end
      @inhalt = Inhalt.new
    end
    if Input.trigger?(Input::B)
      $quest_data[1] = 0
      $scene = Scene_Map.new
      return
    end
  end
end
#===============================================================================
class Inhalt < Window_Base
  def initialize
    super(180, 65, 365, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @lines = []
    @line_width = []
    if $quest_data[2] > 0
      @lines.delete( "Keine Quest vorhanden." )
      for z in 0..$quest_data[2]
        @lines = $quest_inhalt[z].scan(/.{1,50}/) if $quest_data[1] == z
      end
    else
      @lines.push( "Keine Quest vorhanden." )
    end 
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = Color.new(200, 224, 255, 255)
    self.contents.font.size = 15
    for i in 0..@lines.size-1
      @line_width[i] = self.contents.text_size(@lines[i]).width
      self.contents.draw_quest(5, i*32, @line_width[i], 32, @lines[i])
    end
    setVisible
  end
 
def setVisible
    if self.visible
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          self.dispose
        end
        if self.disposed?
          @lines = []
          break
        end
      end
    end
  end
end
################################################################################
class Bitmap 
 
  def draw_quest(x, y, width, height, str)
    str = str.dup 
    bold = font.bold 
    italic = font.italic 
    size = font.size
    underlined = false 
    opacity = 255 
    str.gsub!(/<b>/,"\01")
    str.gsub!(/<\/b>/,"\02") 
    str.gsub!(/<i>/,"\03") 
    str.gsub!(/<\/i>/,"\04")
    str.gsub!(/<small>/,"\20") 
    str.gsub!(/<\/small>/,"\21") 
    str.gsub!(/<big>/,"\23") 
    str.gsub!(/<\/big>/,"\21") 
    str.gsub!(/<size=([0-9]+)>/,"\24[#{$1}]") 
    str.gsub!(/<\/size>/,"\21")
    str.gsub!(/<u>/,"\27")
    str.gsub!(/<\/u>/,"\30") 
    str.gsub!(/<icon=([_A-Za-z0-9-]+)>/,"\11[#{$1}]")
    str.gsub!(/<image=([_A-Za-z0-9-]+)>/,"\31[#{$1}]") 
 
    ix = 0 
    iy = 0 
    while ((c = str.slice!(/./m)) != nil) 
      case c
      when "\01" then
        font.bold = true
      when "\02" then
        font.bold = bold 
      when "\03" then
        font.italic = true 
      when "\04" then
        font.italic = false
      when "\11" then
        str.sub!(/\[([_A-Za-z0-9-]+)\]/, "") 
        icon = RPG::Cache.icon($1) 
        blt(ix + 8, iy + LINE_HEIGHT/2 - 12, icon, Rect.new(0, 0, 24, 24)) 
        ix += 24 
      when "\20" then
        font.size -= 5 if font.size > 10 
      when "\21" then
        font.size = size 
      when "\23" then
        font.size += 5 if font.size < 92 
      when "\24" then
        str.sub!(/\[([0-9]+)\]/, "") 
        newsize = $1.to_i 
        font.size = newsize if newsize > 5 and newsize < 97 
      when "\27" then
        underlined = true 
      when "\30" then 
        underlined = false
      when "\31" then 
        str.sub!(/\[([_A-Za-z0-9-]+)\]/, "") 
        image = RPG::Cache.picture($1) 
        iy += LINE_HEIGHT 
        blt((width-image.rect.width)/2, iy, image, image.rect)
        iy += image.rect.height 
        ix = 0 
      end
      draw_text(x+ix+4, y+iy, 40, font.size, c) 
      w = text_size(c).width 
      if underlined 
        fill_rect(x+ix+4, y+iy+text_size("T").height+3, w, 2, font.color) 
      end 
      ix += w 
    end
    font.bold = bold 
    font.italic = italic 
    font.size = size 
    return iy + LINE_HEIGHT 
  end
end
zum Lesen den Text mit der Maus markieren
»siteplayer« hat folgendes Bild angehängt:
  • Zeichenfehler.png

2

Freitag, 25. September 2009, 18:03

Hat den keiner ne Ahnung wie ich das Quadrat wegbekommen kann? ;(

Ähnliche Themen

Social Bookmarks