Stick and position a letter/character to a value

Hi!

How can I make INDEPENDENT (I meant that for changing colors, size etc) AND STICKED draw letters or characters next to a changeable value (so they will be automatically positioned next to them when the value changes)? What do I need to rewrite?

E.g. a sticked character "+" is placed next to the "changeable" exp value and then is automatically positioned as the needed exp value became lesser (I changed the position in the script manually to show you what I meant):

[IMG]http://s9.postimg.org/oxdi57uor/image.jpg[/IMG]

[IMG]http://s9.postimg.org/njlv9wvff/image.jpg[/IMG]

This is the exp part of a script that modifies the status window a bit (where the "s2" is the exp value):

  def draw_exp_info(x, y)    s1 = @actor.exp_s    s2 = @actor.next_rest_exp_s    s_next = sprintf(Vocab::ExpNext, Vocab::level)    self.contents.font.color = system_color    self.contents.draw_text(x, y + WLH * 0, 90, WLH, Vocab::ExpTotal)    self.contents.draw_text(x, y + WLH * 2, 90, WLH, s_next)    self.contents.font.color = normal_color    self.contents.draw_text(x, y + WLH * 1, 110, WLH, s1, 2)    self.contents.draw_text(x, y + WLH * 3, 110, WLH, s2, 2)  endI can make an independent "+" with this: 

self.contents.draw_text(x, y, "A CHOSEN NUMBER", WLH, "+")but then how do I stick it to the "s2" = exp value (and with the auto-positioning)?

I can make a sticked "+" with this:

s2 = "+ ", @actor.next_rest_exp_sbut then how can I change its color (the blue system color is fine) and size etc?

I started to understand things but still long way to go...
Since you're already working in script, you just need to calculate the number of spaces to be added.


Convert the number to a string, calculate the number of letters in the string, and then add spaces in front of the string until the correct length is reached.


There are other formatting options, but this should do the trick and be easy to understand.
Since you're already working in script, you just need to calculate the number of spaces to be added.

Convert the number to a string, calculate the number of letters in the string, and then add spaces in front of the string until the correct length is reached.

There are other formatting options, but this should do the trick and be easy to understand.
How do I convert the number into string? :S

Did you mean I need to remove the

self.contents.draw_text(x, y + WLH * 3, 110, WLH, s2, 2)and

s2 = @actor.next_rest_exp_sparts

and make it like the description window (the note sticks to the description all right), with the "@" and "set_text" thingies?:

@help_window.set_text(item == nil ? "" : item.description + item.note)So something like:

def update_draw_exp_info @actor.next_reset_exp_s.set_text(@actor.next_rest_exp_s + "+") end(Though this doesn't work.)

Original thread: https://forums.rpgmakerweb.com/threads/stick-and-position-a-letter-character-to-a-value.35814/