Help - Search - Members - Calendar
Full Version: +Advance Text Reader+ version 1.0
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
woratana
Advance Text Reader
Version 1.0
by Woratana
Release Date: 16/02/2008


Introduction
This script will allow you to read text file,

and decorate it to make text more interesting! smile.gif


Features
CODE
+[Features in Version 1.0]+

** Start Read Text File by call script:
$scene = Text_Reader.new("filename with file type")

** Custom Folder for Text File
You can change Text File's folder at line:
TEXT_FOLDER = "folder you want"


Screenshot


This is text file I used for this screenshot:
CODE
[cen][b]Show Text in Center

[/b]No Bold Text here!! *O*
[i][right]Try italic text...
[left][b]Italic with bold ^w^

[cen]Advance Text Reader
by
[/i]Woratana
[b][woratana@hotmail.com]



Script
Place it above main.

Version 1.0
Click to view attachment

Instruction

QUOTE
** Start Read Text File by call script:
$scene = Text_Reader.new("filename with file type")

* For example, you want to read file "test.txt", call script:
$scene = Text_Reader.new("text.txt")

* If your text file is save as UTF-8 encoding
(This encoding is for other languages)
You have to call script like this:
$scene = Text_Reader.new("filename with file type",1)

** Custom Folder for Text File
You can change Text File's folder at line:
TEXT_FOLDER = "folder you want"

"" << for no folder, text file should be in your game's folder.
"Files/" << for folder "Your Game Folder > Files"
"Data/Files/" << for folder "Your Game Folder > Data > Files"


CODE
+[Configuration]+

OPEN_SPEED = Speed when Reader Window is Opening/Closing
SCROLL_SPEED = Speed when player Scroll Reader Window up/down

TEXT_FOLDER = Folder for Text Files
e.g. "Data/Texts/" for Folder "Your Project Folder > Data > Texts"


CODE
+[Decorate Text]+

You can decorate your text by following features:

[b] << Bold Text
[/b] << Not Bold Text

[i] << Italic Text
[/i] << Not Italic Text

[s] << Text with Shadow
[/s] << Text without Shadow

[cen] << Show Text in Center
[left] << Show Text in Left side
[right] << Show Text in Right side

* Note: Don't put features that have opposite effects in same line...
For example, [b] that make text bold, and [/b] that make text not bold

* Note2: The decoration effect will be use in the next lines,
Until you use opposite effect features... For example,

[b]text1
text2
[/b]text3

text1 and text2 will be bold text, and text3 will be thin text.



Author's Notes
Free for use in your non-commercial work if credit included. If your project is commercial, please contact me.

Please do not redistribute this script without permission. If you want to post it on any forum, please link to this topic.
Endzeit
Ooooo this is nice. Something you could add is... oooohh the I don't know how to put it..... 'Block Recognition.'??? lol Like have the script be able to select a specific block within the text file. A search I guess.

like

[block=1]
<text reader stuff>
[/block]

then search for block 1. *shrug*
Denko
I'm confused... what exactly does this do?
Does it display a text file in the game?
woratana
@Endzeit
Ah, that's hard =[]@!

(Not really smile.gif, but it's just not so easy.)

Nice Idea! Thanks

@Denko
Yep, display text file in game, and you can decorate it to make a better look laugh.gif
shaman666
that's an amazing script
you should make something that writes on a file, and make the window size customizable

I would probably use on my project if those worked
like some kind of in-game notepad... would be amazing
Diedrupo
Question, since it is reading from text files, does it work if the project is encrypted? I remember that this sort of thing failed in RMXP because text files would be within the encryped rgssd file and the game could not access them.
woratana
@Shaman666
Window customizable will not be hard, but to make notepad in game needs pretty much work smile.gif

@Diedrupo
That's good point.

I tried that with this script in RMXP version (because I cannot encrypt project in VX trial), and it works fine.

When you encrypt project, text file will not include in rgssad file, so the game will be able to read it laugh.gif
lahandi
Mr. Warotana, this is great. This is what I'm looking for. But I cant try it now.

I wonder, how you create a wide and tall message window like that (is it autofit)? And is it automatically in the center of the game screen if we call the script ($) ?
Rory
Hey, nice script. It could come into good use.
woratana
@lahandi

It's not message window, and it will always in screen size. (544*416)

Because of it's not message window, so you cannot use the features in normal message window tongue.gif.

@Magdreamer

Thanks smile.gif
spazta666
sorry for a semi-bump, but does this script get rid of the B button in-game? cos now when i test i cant access the menu (0/B button) ? just a Q

~Spaz
woratana
I don't think so.

Try take out this script from your game and see if you can use B now.
spazta666
nah dw, i fixed it, Was nothing to do with the script, Just something non scientists would call a coincidence.

~Spaz
From_Ariel
If I had A very large text file can this message display system auto scroll the text up the screen so this could be used to display an intro story to the game or end credits?

If that feature doesn't exist could you add that functionality maybey a command like

auto scroll = (0 - 100)

You could put this in the text file possibly even several times if you wanted it to speed up and slow down for some reason


1 being so slow it barely moves and 100 being so fast you can't read it?


Also while I'm at it could you add a pause command that waits for the action button to move again?


Thnx just another freindly suggestion for you Wortana biggrin.gif rolleyes.gif thumbsup.gif

wub.gif Ariel
From_Ariel
I reread the script and realized i think it can scroll

just an fyi re: encrypted files....... this is from the help

Possibly you could set a config flag in the script

encrypted = true / false

if true it uses load_data instead of file open

load_data(filename)


Loads the data file indicated by filename and restores the object.

$data_actors = load_data("Data/Actors.rvdata")
This function is essentially the same as:

File.open(filename, "rb") { |f|
obj = Marshal.load(f)
}


However, it differs in that it can load files from within encrypted archives.

save_data(obj, filename)
Saves the object obj to the data file indicated by filename.

save_data($data_actors, "Data/Actors.rvdata")

This function is the same as:
File.open(filename, "wb") { |f|
Marshal.dump(obj, f)
}



it is defined as a counterpart to load_data.


Ariel
Senpuu
Good one, Woratana! biggrin.gif I have some suggestions, if that OK with you. Maybe you can make the window transparent, and the text can scrolled automatically just like From_Ariel said. smile.gif
Michael
Yay!
Worked, thanks man I really need it!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.