Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: AlphusBetus on July 31, 2015, 09:46:07 am

Title: Reverse Text script request
Post by: AlphusBetus on July 31, 2015, 09:46:07 am
---
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 01, 2015, 12:04:15 am
To make matters even worse, the RMXP Editor won't even allow you to input Arabic characters. They just immediately turn into question marks. There are ways to work around it such as using a script that replaces a variable with a string containing Arabic characters (Localization (http://forum.chaos-project.com/index.php/topic,12164.0.html) might help).

Seeing as RMXP is drawing the characters from right to left, the logical solution is to purposefully make the characters be drawn left to right. Now I don't see why a script is really necessary if that third-party program does this mirroring for you.

(http://puu.sh/jkXxP/9d32e91b7d.png)

As you can see, the first string of Arabic text was taken from the youtube video you posted. I then mirror'd the text and used a Show Message to give me the above result.

To even get my message to display Arabic, I created this module, used a Script Call in my event

$game_variables[100] = Arabic.text

And then used Show Message:

\V[100]
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 01, 2015, 02:02:13 am
Copied the second to last and it did this in the editor. But it appeared to have not flipped in the end.
(http://puu.sh/jl3kl/0a3b16b5a6.png)
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 01, 2015, 02:41:29 am
Quote from: KK20 on August 01, 2015, 12:04:15 am
To make matters even worse, the RMXP Editor won't even allow you to input Arabic characters. They just immediately turn into question marks.

Spoiler: ShowHide
(http://puu.sh/jl5ax/7d126b9436.gif)


Quote from: KK20 on August 01, 2015, 12:04:15 am
There are ways to work around it such as using a script that replaces a variable with a string containing Arabic characters (Localization (http://forum.chaos-project.com/index.php/topic,12164.0.html) might help).


By the way, I'm fairly confident none of those scripts you posted did anything. The third-party program is all you need.
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 01, 2015, 03:41:50 am
After playing around with RMVXA, turns out that the font VL Gothic (which is the default font for all new projects) doesn't support Arabic characters. Changing the Font.default_name to Tahoma (or any other font that supports Arabic characters) fixes that.

Thus all you really need to do is go to Main and put this line just above the "rgss_main"

Font.default_name = ["Tahoma", "PLUS ANY OTHER FONTS THAT SUPPORT ARABIC", "SEPARATED BY COMMAS OF COURSE"]


Clearly, RMVXA's Editor has Unicode support (finally) while RMXP's does not. If you are asking for a script that makes the Show Message command NOT convert the characters to question marks, we need to have a long talk about what exactly you can do with scripts.

EDIT:
This is about as helpful as a script will get

module Arabic
  @all_arabic_strings ={
  #---------------------------------------------------------------------------
  # Begin Configuration
  #---------------------------------------------------------------------------
    "1" => "ﺏﺮﻌﻤﻟﺍ",
    "2" => "ﺏﺮﻌﻤﻟﺍ",
    "System" => "ﺏﺮﻌﻤﻟﺍ"
  #---------------------------------------------------------------------------
  # End Configuration
  #---------------------------------------------------------------------------
  }
  def self.text(key)
    @all_arabic_strings[key]
  end
end

class Window_Message < Window_Selectable
 
  alias refresh_for_arabic refresh
  def refresh
    if $game_temp.message_text != nil
      $game_temp.message_text.gsub!(/\\[Aa]\[(.+)\]/) { Arabic.text($1) }
    end
    refresh_for_arabic
  end
 
end

In between the rectangles for configuration, assign a keyword on the left to correspond to the actual Arabic sentence/word on the right. Just follow the example I provided. Then, in a Show Text command, you can do

\A[1]
\a[2]
\a[System]

And this will print out your Arabic characters. Note this only applies to the Message Window and nothing else in the game.
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 02, 2015, 02:11:30 am
1. Does your project contain the class Window_Selectable?
2. Did you put my script somewhere below Scene_Debug and above Main?
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: Blizzard on August 02, 2015, 03:07:08 am
Yeah, Pokemon Essentials is a whole different system. If I remember right, they don't have Window_Selectable.
Title: Re: Reverse Arabic Text: RGSS3/RGSS2 to RGSS [RMAce/VX to RMXP] script request
Post by: KK20 on August 02, 2015, 03:08:37 am
Yeah, I'm not too familiar with the project in general. Can't help you with that :\