Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Vai al contenuto

Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Screen Contest #90

Kamikun






  • Si prega di effettuare il log in prima di rispondere
Script: Modern Algebra's Global Text Codes

    alegasta92
  • Utente occasionale

  • Utenti
  • Rens: 0
  • 0
  • StellettaStelletta
  • 195 messaggi
  • Sesso:Maschio
  • Provenienza:milano
  • Abilitā:Iniziato

#1 Inviato 14 December 2012 - 16:09 PM

Codici Globali per Testi

"Global Text Codes"

Immagine inserita

Autore: Modern Algebra


Per: Rpg maker VX-ace(RGSS3)

Utilità:Questo script permette di inserire i codici testo applicabili nei messaggi (/C[n] e compagnia bella) in qualsiasi casella di testo.
Questo comporta quindi:
-Possibilità di avere icono vicino ai comandi di gioco (Per esempio nel menù principale)
-Possibilità di cambiare il colore degli oggetti, delle armi e delle armature a proprio piacimento.
-Possibilità di inserire numeri di variabili in qualsiasi casella di testo,
-Possibilità di ingrandire o rimpicciolire il carattere a piacimento.

Installazione:
Da inserire sotto materiali e,una volta finito il gioco, dare parte dei crediti anche al lavoro di Modern Algebra.
IMPORTANTE:se volete che lo script faccia il suo lavoro, dovete mettere dove c'è qualche codice testuale da
mettere "\*"
ESEMPIO: Voglio colorare di verde la scritta "ascia comune"
Non faccio" \C[5] ascia comune\C[0]", ma piuttosto" \*\C[5] ascia comune\C[0]"

DEMO:
Non vi è alcuna demo

Script:


#==============================================================================
# Global Text Codes [VXA]
# Version: 1.0a
# Author: modern algebra (rmrk.net)
# Date: April 5, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Descrizione:
#
# Questo script permette l'uso di codici dei messaggi in ogni finestra e non
# solo in quella dei messaggi. Puoi colorare la scritta, aggiungere icone, ingrandirla
# a tuo piacimento.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Copia lo script sotto materiali e sopra Main.
#
# Ci sono due opsioni di funzionamento dello script:
# - AUTOMATICA(automatic): Tutto ciò che dovrai fare sarà inserire i codici nei messaggi e tutto funzionerà.
# - MANUALE(manual): Prima di inserire il codice bisognerà inserire \*
#
# Puoi utilizzare:
#
# \c[n] - Cambia il colore. Il colore dipende da n.
# \i[n] - Inserisce l'icona con ID=n.
# \p[n] - Scrive il nome del personaggio in posizione n nel party: se 1 è il party leader, se 2 il secondo membro.
# \n[n] -Scrive il nome del personaggio con ID=n
# \v[n] - Mostra il contenuto della variabile con ID= n.
# \g - Mostra l'unità di scambio (la moneta corrente).
#
# Se si stà usando uno script di personalizzazione del messaggio, potresti avere codici
# aggiuntivi a tua disposizione. Lo script è compatibile con L'ATS di modern algebra e
# molti codici, tranne \x e quelli per il controllo del messaggio, funzioneranno.
#
#==============================================================================
$imported = {} unless $imported
$imported[:MAGlobalTextCodes] = true
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Editable Region
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# MAGTC_MANUAL_CODES - If this is true, then you must put a \* code in any
# field that you want to have codes interpreted in. Otherwise, codes will
# always automatically be interpreted. The recommended value for this is true,
# as the process for drawing text with codes is much slower than the process
# for drawing text without codes.
MAGTC_MANUAL_CODES = true
# MAGTC RCODES - This feature is designed to overcome the space limitations in
# much of the database - since codes take so much of that space, it might be
# difficult to write everything you want into one of those fields. This feature
# permits you to write the term you want in to the following array, and then
# access it in the database with the code \r[n], where n is the ID you assign
# to the phrase in the following way:
#
# n => "replacement",
#
# Please note that: it is =>, not =; the replacement must be within quotation
# marks; and there must be a comma after every line. If using double quotation
# marks ("", not ''), then you need to use two backslashes to access codes
# instead of one (\\c[1], not \c[1]).
#
# EXAMPLE:
# 0 => "\\i[112]\\c[14]New Game\\c[0]",
#
# Under the New Game field in the Terms of the Database, all I would then need
# to put is:
# \*\r[0]
# and it would be the same as if I had put:
# \*\i[112]\c[14]New Game\c[0]
MAGTC_RCODES = { # <- Do not touch
0 => "\\i[112]\\c[14]New Game\\c[0]", # Example
1 => "", # You can make as many of these as you want
2 => "\\i[40]Blood Hound",
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END Editable Region
#//////////////////////////////////////////////////////////////////////////////
}
MAGTC_RCODES.default = ""
#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - draw_text; convert_escape_characters; process_new_line;
# reset_font_settings
# new methods - magtc_align_x; magtc_test_process_escape_character;
# magtc_calc_line_width
#==============================================================================
class Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Scrivi testo
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_gtc_drwtxt_3fs1 draw_text
def draw_text(*args, &block)
# Get the arguments
if args[0].is_a?(Rect)
x, y, w, h = args[0].x, args[0].y, args[0].width, args[0].height
text, align = *args[1, 2]
else
x, y, w, h, text, align = *args[0, 6]
end
align = 0 unless align
# Draw normally if text is not a string, draw normally if the text is not
# long enough to hold a code, and draw normally when the script is set to
# manual and \* is included in the text
if !text.is_a?(String) || text.size < 2 || (MAGTC_MANUAL_CODES && text[/\\\*/].nil?)
ma_gtc_drwtxt_3fs1(*args, &block) # Run Original Method
else
@magtc_reset_font = contents.font.dup # Do not automatically reset font
@magtc_rect, @magtc_align = Rect.new(x, y, w, h), align
# Get first line of the text to test for alignment
@magtc_test_line = convert_escape_characters(text[/.*/])
y += [(h - calc_line_height(@magtc_test_line)) / 2, 0].max
# Draw text with message codes
draw_text_ex(magtc_align_x(x), y, text)
@magtc_reset_font = nil # Do not automatically reset font
@magtc_rect, @magtc_align = nil, nil # Reset Rect and Alignment
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Escape Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_gtc_convescchar_5tk9 convert_escape_characters
def convert_escape_characters(text, *args, &block)
# Remove \* codes
new_text = text.gsub(/\\\*/, "")
# Substitute for the R Codes
new_text.gsub!(/\\[Rr]\[(\d+)\]/) { MAGTC_RCODES[$1.to_i].to_s }
ma_gtc_convescchar_5tk9(new_text, *args, &block) # Call Original Method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reset Font Settings
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias magtc_resetfonts_4ga5 reset_font_settings
def reset_font_settings(*args, &block)
magtc_resetfonts_4ga5(*args, &block) # Call Original Method
contents.font = @magtc_reset_font if @magtc_reset_font
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Process New Line
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias magtc_prcsnewl_5gn9 process_new_line
def process_new_line(text, pos, *args, &block)
magtc_prcsnewl_5gn9(text, pos, *args, &block) # Run Original Method
if @magtc_align && @magtc_rext
@magtc_test_line = text[/.*/] # Get new line
pos[:x] = magtc_align_x # Get the correct x, depending on alignment
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Alignment X
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def magtc_align_x(start_x = @magtc_rect.x)
return start_x unless (@magtc_rect && @magtc_align && @magtc_test_line) || @magtc_align != 0
tw = magtc_calc_line_width(@magtc_test_line)
case @magtc_align
when 1 then return start_x + ((@magtc_rect.width - tw) / 2)
when 2 then return start_x + (@magtc_rect.width - tw)
end
start_x
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Calc Line Width
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def magtc_calc_line_width(line)
# Remove all escape codes
line = line.clone
line.gsub!(/[\n\r\f]/, "")
real_contents = contents # Preserve Real Contents
# Create a dummy contents
self.contents = Bitmap.new(@magtc_rect.width, @magtc_rect.height)
reset_font_settings
pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
tw = 0
while line[/^(.*?)\e(.*)/]
tw += text_size($1).width
line = $2
# Remove all ancillaries to the code, like parameters
code = obtain_escape_code(line)
magtc_test_process_escape_character(code, line, pos)
end
# Add width of remaining text, as well as the value of pos[:x] under the
# assumption that any additions to it are because the special code is
# replaced by something which requires space (like icons)
tw += text_size(line).width + pos[:x]
self.contents.dispose # Dispose dummy contents
self.contents = real_contents # Restore real contents
return tw
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Test Process Escape Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def magtc_test_process_escape_character(code, text, pos)
if $imported[:ATS_SpecialMessageCodes] && ['X', 'HL'].include?(code.upcase)
obtain_escape_param(text)
return
end
process_escape_character(code, text, pos)
end
end



Link al sito di Modern Algebra:
http://rmrk.net/inde...ic,44810.0.html

Immagine inserita
Visita il progetto:http://www.rpg2s.net...showtopic=16180

Spoiler


    Punk
  • Nuovo Arrivato

  • Utenti
  • Rens: 20
  • 0
  • Stelletta
  • 80 messaggi
  • Sesso:Maschio
  • Abilitā:Apprendista

#2 Inviato 14 December 2012 - 16:20 PM

Davvero utile, non conoscevo proprio questo script, bravo :)

    alegasta92
  • Utente occasionale

  • Utenti
  • Rens: 0
  • 0
  • StellettaStelletta
  • 195 messaggi
  • Sesso:Maschio
  • Provenienza:milano
  • Abilitā:Iniziato

#3 Inviato 14 December 2012 - 17:02 PM

L'ho appena scoperto! Se qualcuno vuole comunque vedere se ci sono altri script utili vada sul link che ho postato.

Mi sono dimenticato di scrivere una cosa:

Dato che a volte le scritte fuoriescono dalla finestra (mettete icone, colore eccetura sulla finestra del nuovo gioco) lo script da la possibilità di usare
il codice \r[n], o meglio il codice di replace.
Nello script, infatti, vi è la possibilità di assegnare a degli ID numerici delle scritte lunghe. in modo che compaia al posto di \r[n] dove n è l'ID numerico della parola.
Inoltre ogni codice dovrà avere due slash per funzionare (\\i[n], \\G, \\c[n]).
Ad esempio:


0 => "\\i[112]\\c[14]Tua Mamma\\c[0]"
in questa array si vede infatti che:
- L'ID dell'array è 0
-viene messa l'icona 112 tramite il codice \\i[112]
- il tutto è colorato in pattern 14 da \\c[14] e riportato a colore base da \\c[0]

Immagine inserita
Visita il progetto:http://www.rpg2s.net...showtopic=16180

Spoiler


    Guardian of Irael
  • Coniglietto Rosso

  • Rpg˛S Admin
  • Rens: 195
  • 19
  • StellettaStellettaStellettaStellettaStellettaStelletta
  • 58424 messaggi
  • Sesso:Maschio
  • Provenienza:Bagnaia (Viterbo)
  • Abilitā:Apprendista


#4 Inviato 14 December 2012 - 19:00 PM

Te lo sei rivenduto subito insomma! XD
Bravo, buona cosa, è utile sotto vari aspetti come script! ^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!     
(> <)

 
Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^
 
KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^
 
FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^  
 
REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

Spoiler


    alegasta92
  • Utente occasionale

  • Utenti
  • Rens: 0
  • 0
  • StellettaStelletta
  • 195 messaggi
  • Sesso:Maschio
  • Provenienza:milano
  • Abilitā:Iniziato

#5 Inviato 14 December 2012 - 19:16 PM

Io direi che è cosa buona e giusta!XD

Immagine inserita
Visita il progetto:http://www.rpg2s.net...showtopic=16180

Spoiler


    Yoshi91
  • Utente avanzato

  • Utenti
  • Rens: 40
  • 0
  • StellettaStellettaStelletta
  • 476 messaggi
  • Sesso:Maschio
  • Provenienza:Isola Yoshi
  • Abilitā:Apprendista

#6 Inviato 21 December 2012 - 21:34 PM

Utile, già inserito nel progetto mio!!
Potrebbe anche servire per indicare le potenzialità delle armi, tipo nomi rossi per armi potenti...
Ci sono tante possibilità!
PS. Grazie per averlo postato e tradotto.
Gioco in costruzione: Yoshi Party #Link al topic#
% completamento: [color=#ff0000;]2%[/color] (Userò il VX Ace e non più il VX)

La mia bottega, dove potreste chiedermi di tradurvi scripts per VX e VX-Ace in italiano o di programmarvi eventi in cambio di rens! BOTTEGA QUI
Sei un grafico e vuoi essere reclutato per Yoshi Party? Vai qui!
 
Scripts, Tutorial e Risorse postate qui da me per VX e VX Ace!
Spoiler

  Immagine inserita             
 
[font="'comic sans ms', cursive;"][color=rgb(0,128,0);]*wahuu!*[/color][/font]




  • Feed RSS