Hey,
vielleicht ist dieser Ansatz das, was du suchst. Du kannst Kommentare in Events verwenden, die dann in Texte umgewandelt werden.
Allerdings kam ich noch nicht dazu, das Script auch zu testen. Hab's nur kurz erstellt und an 2-3 Beispielen getestet. Sollten dir irgendwelche Fehler ins Gesicht springen, gibt einfach Bescheid.
Füge das folgende Script einfach über Main ein:
Code:
class Interpreter
# call command_108 method if comment command is used
alias org_execute_command execute_command
def execute_command
if(@index < @list.size)
if(@list[@index].code == 108) #comment command
return command_108
else
return org_execute_command
end
else
command_end
return true
end
end
def command_108
mls = 448 # max textsize per line
text = @list[@index].parameters[0] # first line of the comment command
#for every addtional command line (code = 408) // max. 5 additional lines
for i in 1..5
if(@list[@index+i].code == 408)
text += @list[@index+i].parameters[0]
else
break
end
end
#after extracting texts, delete old comment lines from event command list
for i in 0..4
if(@list[@index+5-i].code == 408)
@list.delete_at(@index+5-i)
else
break
end
end
tmsgbx = Bitmap.new(1,1)
# multiple lines needed?
if(tmsgbx.text_size(text).width>mls)
iLength = 0
textarray = [""]
## create Substrings
substrings = text.scan(/\S+|\s+/)
## check if line size limit is reached and switch to next line
substrings.each do |ttext|
subsize = tmsgbx.text_size(ttext).width
linesize = tmsgbx.text_size(textarray[iLength]).width
if(( subsize + linesize) > mls)
iLength = iLength + 1
end
if(textarray[iLength]!=nil)
textarray[iLength]= textarray[iLength]+ttext
else
ttext.slice!(/\s*/)
textarray[iLength]= ttext
end
end
## insert every line as command list element
added = 1
textarray.each_with_index do |msgtext,indx|
if(indx == 0)
@parameters = msgtext
@list[@index].code = 101
else
@list.insert(@index+added, RPG::EventCommand.new())
@list[@index+added].parameters[0] = msgtext
@list[@index+added].code = (indx % 4) == 0 ? 101 : 401
added += 1
end
end
command_101
else
## one-liner
command_101
end
end
end