Ultima Forum

Pełna wersja: Edycja skryptu
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
Gdyby ktoś był łaskaw "ztunningować" mi 2 skrypty, był bym bardzo wdzięczny.

I.
Tutaj prosiłbym o coś dzięki czemu text można by przesówać. Chodzi o to żeby można było go przesówać w górę i w dół np. strzałkami. tak jak w zwykłym wordzie czy notatniku
Kod:
=begin

ATP(Advanced Text Paragrapher) V1.0 by Samo, The thief

Ok, Something of The Scripters do normally to draw a text in form of a paragraph is
doing an array [] that contains each line. The Time Has come For
This Microsoft Word Effect!
This Script Just need a Long String and it will paragraph it!

How to call it?

paragraph = str_paragraph(string, width of the paragraph.)

Example :

@my_paragraph = str_paragraph("La la la la la la la la la , This is a Looooong Strriiiing!", 120)


Returns an Array with each line separately.

How to draw it?

draw_paragraph(x,y,width,height, paragraph)

width and height for each line, not for the paragraph.

.::-NOTE-::.

If you put a ' ^ '(must be between spaces), the text will pass to the next line.
This Symbol Won't be drawed.

Reminder: Always use '' instead of ""! It works faster!

=end


class Window_Base < Window
#--------------------------------------------------
  def str_paragraph(str_old, width)
    temp_str = ''
    str = '' + str_old
    words = []
    size = 0
    str_size = 0
    #
    while ((c = str.slice!(/./m)) != nil)
      temp_str += c
      str_size += 1
      if c == ' '
        words.push(temp_str)
        temp_str = ''
      end
      if str.size == 0
        words.push(temp_str)
        temp_str = ''
      end
    end
    lines = []
    for i in 0...words.size
      word = words[i]
      if word == '^ '
        lines.push(temp_str)
        temp_str = ''
        next
      end
      temp_str += word
      size = contents.text_size(temp_str).width
      if size > width - contents.text_size(' ').width
        for i in 1..word.size
          temp_str = temp_str.chop
        end
        lines.push(temp_str)
        temp_str = ''
        temp_str += word
      end
    end
    words = words.compact
    if temp_str != ''
      lines.push(temp_str)
    end
    return lines
  end
#---------------------------------------------------------------------
  def draw_paragraph(x,y,width,height,lines,align = 0)
    for i in 0...lines.size
      self.contents.draw_text(x, y + i * self.contents.font.size + 1, width, height, lines[i], align)
    end
  end
#-----------------------------------------------------------------
end

II.
Oraz drugie, nieco trudniejsze, w Mr.Mo ABS można przypisać sobie czary pod klawisze od 1 do 9 i używać ich na zwykłej mapce, ich ikonki i nazwy są wyświetlane na pasku u góry (HUD). Chciałbym aby można było tam też przypisywać niektóre przedmioty. Dobrze by było, aby trzeba było np. dopisać ich ID w skrypcie.

SCRIPT:
http://download1322.mediafire.com/g2bt7x...SCRIPT.txt

Ja nikomu nie mówie że ma to zrobić i to już. Po prostu mówię że jeśli ktoś ma czas, chęci to może mi pomóc. Najpierw Bardziej by mi zależało na tym pierwszym.
Przekierowanie