Uhrskript, Version 1.16
Features:-Erlaubt dem Nutzer des Skripts, die momentane Uhrzeit (die echte die in Windows [oder wo auch immer] eingestellte) als extra Fenster während des Spiels anzuzeigen.
- Mit dem Skript lässt sich abfragen, welche Uhrzeit gerade ist. ( Zum Beispiel ein Geist der um 0:00 Uhr erscheint. Da gibt es viele gute Beispiele)
- vieles mehr
Einbau:
Das Skript einfach als neues einfügen.
Die Erklärung wurde entfernt, sie ist nicht mehr aktuell. Bitte benutzt das Skript. Im Kommentar am Anfang wird alles erklärt.
Dann müsst ihr nur noch die Windowskins ersetzen um Anzeigefehler zu vermeiden. Es müssen einfach nur diese Pfeile heraus editiert werden. Ein paar davon findet ihr hier:
www.gamko.bplaced.net , oder direkt hier runterladen: http://www.abload.de/gallery.php?key=rHPqNxg1
Code:
#==============================================================================#
# ** Uhrskript #
# Fertig gestellt am: 13.11.2009 #
#------------------------------------------------------------------------------#
#==============================================================================#
#------------------------------------------------------------------------------#
# Uhrskript #
# By: Gamko [Einen Dank an: Hindi & Agenty & Eirin #
# Version: 2 #
#------------------------------------------------------------------------------#
=begin
Unten sind die Einstellungen zum Skript Kommentare stehen dazu:
Zusätzlich habe ich noch die möglichkeit eingebaut abzufragen ob grad eine
bestimmte Zeit ist, zuerst schreibt ihr $scene.uhr.its_ und dann die Zeitmasse
also so its_hour?(23) für die Stunde dannach wird ein Boolean Wert geliefert
also wenn das so ist dann wird true geliefert, wenn nicht dann false, so könntet
ihr z.b prüfen ob es gerade 22 Uhr ist, dann gibt es noch die eigenschaften
min für minute; also its_min?(10) und its_sec?(3) für Sekunde.
Und its_time?("23:40:32") ja bei its_time? dürfen die anführungszeichen nicht
fehlen und es muss genau dieses Format haben. es gibt aber auch noch
its_day_in month (Monatstag) /week (Wochentag) /day (Tag des Jahres)
Wenn ihr in einem Corditional Branch Prüfen möchtet ob es z.b gerade 10min nach
ist so wählt ihr im Corditional Branch Skript aus dann schreibt ihr da:
its_min?(10) == true | wenn es aber nicht so spät sein soll,
dann schreibt ihr stattdessen false oder != statt ==.
Wenn ihr aber überprüfen wollt ob die Stunde grösser ist als etwas dann schreibt
ihr stattdessen in das Skript im Corditional Branch: get_ hour, min, sek
und dann > für grösser als oder < für kleiner als also z.b so: get_hour > 10.
Desweiteren gibt es noch get_day_in week (Wochentag) /month (Monat) /year (Jahr).
Wenn ihr das Fenster ausblenden wollt mach schreibt ihr folgenden Code:
$uhr.visible = false. Wenn ihr die Koordinaten des Fensters ändern wollt dann
schreibt ihr $scene.uhr.x = 20.
Ihr könnt auch den Fontcolor verstellen, dies geht so:
$uhrzeit.contents.font.color = Color.new(f1, f2, f3, optional Alpha)
Oder die Text_size (Die Textgrösse): $uhrzeit.contents.font.size = size.
=end
DATE = false #Bestimmt ob Datum oder nur Zeit angezeigt ist,
#wird true gewählt wird das ganze Datum angezeigt bei false nur die Uhrzeit
TEXTGROESSE = 24 #Bestimmt die Textgroesse
USE_SHADOW = true
FWS_ARE_VARS = true
#Standartwerte für die Variablen mit den Ids von FW1,FW2,FW3 falls FWS_ARE_VAR = true
STANDART_FW1 = 255
STANDART_FW2 = 255
STANDART_FW3 = 255
FW1 = 6 #FW1 abk. für Farbenwert1 steht für den ersten Wert für die Schriftfarbe
FW2 = 7 #FW2 abk. für Farbenwert1 steht für den zweiten Wert für die Schriftfarbe
FW3 = 8 #FW3 abk. für Farbenwert1 steht für den dritten Wert für die Schriftfarbe
#Wenn ihr die Farbwerte Variabel haben wollt müsst ihr die Einstellung 'FWs_variables?' auf true stellen ansonsten auf false
#SWITCH um das Uhrskript an/aus zu stellen
SWITCH = 1
#Standartkoordinaten für das Uhrskript
STANDART_X = 10
STANDART_Y = 10
#Variablen welche verwendet werden um die Koordinaten anzupassen
XVAR = 4
YVAR = 5
#Datei welche als Tickgeräusch verwendet wird, wenn kein Tickgeräusch ertönen soll schreibt ihr ein Minuszeichen (-) in die Anführungszeichen.
TICKING_SOUND = "Tick.mp3"
#Laustärke des Tickgeräusches
TICKING_SOUND_VOLUME = 1
#Wert für den Pitch (ein Wert für die Tonhöhe und Tonlänge des verwendeten Tickgeräusch Sound)
TICKING_SOUND_PITCH = 50
class Scene_Title
alias :command_new_game_saver :command_new_game
def command_new_game()
$game_variables[XVAR] = STANDART_X
$game_variables[YVAR] = STANDART_Y
if FWS_ARE_VARS
$game_variables[FW1] = STANDART_FW1
$game_variables[FW2] = STANDART_FW2
$game_variables[FW3] = STANDART_FW3
end
command_new_game_saver()
end
end
class Scene_Map
attr_accessor :fontcolor
attr_accessor :uhr
alias :main_saver :main
alias :update_saver :update
def main()
@fontcolor = []
if FWS_ARE_VARS
@fontcolor.push($game_variables[FW1])
@fontcolor.push($game_variables[FW2])
@fontcolor.push($game_variables[FW3])
else
@fontcolor.push(FW1)
@fontcolor.push(FW2)
@fontcolor.push(FW3)
end
create_clock()
main_saver()
@uhr.dispose
end
def create_clock()
@uhr=Uhrzeit.new($game_variables[XVAR],$game_variables[YVAR],TEXTGROESSE,@fontcolor)
end
def update()
if $game_switches[SWITCH]
@uhr.visible=true
@uhr.update
if Input.trigger?(Input::F5)
#Zufallsschriftfarbe zuweisen
@uhr.update_fontcolor()
@uhr.set_random_fontcolor()
end
if Input.trigger?(Input::F6)
#Position fixieren
@uhr.take_this_pos()
end
if Input.trigger?(Input::F7)
#Standartkoordinaten annehmen
@uhr.reset_xy()
end
if Input.trigger?(Input::F8)
#Standartschriftfarbe
@uhr.set_fontcolor_with_values(STANDART_FW1,STANDART_FW2,STANDART_FW3)
end
else
@uhr.visible=false
end
update_saver()
end
end
class Uhrzeit < Window_Base
attr_accessor :window
attr_accessor :ticking_sound
def initialize(x, y, text_size, color)
@ticking_sound = true
@bitmap = Bitmap.new(640, 480)
@bitmap.font.size = text_size
@bitmap.font.color = Color.new(color[0], color[1], color[2])
if DATE == true
@width = @bitmap.text_size("99:99:99 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW").width
@height = text_size + 15
else
@width = @bitmap.text_size("99:99:99").width
@height = text_size + 10
end
super(x, y, @width + 50, @height + 30)
self.contents = Bitmap.new(@width + 40, @height + 20)
self.contents.font.color = @bitmap.font.color
@visible = true
@old=-1
update()
end
def update()
@t = Time.now()
if @old != @t.sec
@old=@t.sec
paint_timer()
if @ticking_sound
if TICKING_SOUND != "-"
tick = RPG::SE.new(TICKING_SOUND,TICKING_SOUND_VOLUME,TICKING_SOUND_PITCH)
tick.play
end
end
end
end
def paint_timer()
update_fontcolor()
self.contents.clear()
showtime = ""
if DATE == true
showtime = get_date
else
showtime = get_time
end
self.contents.draw_text(0, 0, @width, @height, showtime, 1)
end
def get_date
return get_this_season.to_s + " " + get_time.to_s + " " + get_dayword_today.to_s + " der " + get_day_in_month.to_s + "te " + get_this_monthword.to_s + " " + get_year.to_s + "."
end
def its_day_in_week(day)
return(@t.wday == day)
end
def its_day_in_year(day)
return(@t.yday == day)
end
def its_day_in_month(day)
return (@t.day == day)
end
def its_hour?(hour)
return (get_hour() == hour)
end
def its_min?(min)
return(get_min() == min)
end
def its_sec?(sec)
return(Get_sec() == sec)
end
def its_time?(time)
return(get_time() == time)
end
def get_dayword_today()
return get_dayword(@t.wday)
end
def get_this_monthword()
return get_monthword(@t.mon)
end
def value_is_between?(min,max,value)
if value > min
return(value < max)
end
end
def get_this_season()
return get_season(@t.mon)
end
def get_season(monthnumber) #der Monat wird in einer Zahl von 1 bis 12 angegeben
seasons = ["Frühling", "Sommer", "Herbst", "Winter"]
case monthnumber
when 3..5
return seasons[0]
when 5..8
return seasons[1]
when 9..11
return seasons[2]
when 11..12
return seasons[3]
when 1..2
return seasons[3]
end
end
def get_dayword(daynumber)
days = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"]
return days[daynumber - 1]
end
def get_monthword(monthnumber)
months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
return months[monthnumber - 1]
end
def get_day_in_week()
return @t.wday
end
def get_day_in_year()
return @t.yday
end
def get_day_in_month()
return @t.day
end
def get_year()
return @t.year
end
def get_mon()
return @t.mon
end
def get_time()
return get_hour() + ":" + get_min() + ":" + get_sec()
end
def get_hour()
return @t.hour.to_s
end
def get_min()
if @t.min > 9
return @t.min.to_s
else
return "0" + @t.min.to_s
end
end
def get_sec()
if @t.sec > 9
return @t.sec.to_s
else
return "0" + @t.sec.to_s
end
end
def its_between_hours?(min,max)
if @t.hour >= min
if (@t.hour < max)
return true
elsif (@t.hour == max)
return(@t.min == 0)
elsif (@t.hour > max)
return false
end
else
return false
end
end
def its_between_mins?(min,max)
if @t.min >= min
if (@t.hour < max)
return true
elsif (@t.hour == max)
return(@t.secs == 0)
elsif (@t.hour > max)
return false
end
else
return false
end
end
def its_between_secs?(min,max)
if @t.sec >= min
return(@t.sec <= max)
else
return false
end
end
def its_between_ydays?(min,max)
if @t.yday >= min
return(@t.yday <= max)
else
return false
end
end
def its_between_mons?(min,max)
if @t.mon >= min
if (@t.mon < max)
return true
elsif (@t.mon == max)
return(t.mday == 0)
elsif(@t.mon > max)
return false
end
else
return false
end
end
def its_between_years?(min,max)
if @t.hour >= min
return(@t.hour <= max)
else
return false
end
end
def reset_xy()
$game_variables[XVAR] = STANDART_X
$game_variables[YVAR] = STANDART_Y
self.x = STANDART_X
self.y = STANDART_Y
update()
end
def update_fontcolor
if FWS_ARE_VARS
$scene.fontcolor = []
$scene.fontcolor.push($game_variables[FW1])
$scene.fontcolor.push($game_variables[FW2])
$scene.fontcolor.push($game_variables[FW3])
if @bitmap.font.color != Color.new($scene.fontcolor[0],$scene.fontcolor[1],$scene.fontcolor[2])
@bitmap.font.color = Color.new($scene.fontcolor[0],$scene.fontcolor[1],$scene.fontcolor[2])
self.contents.font.color = @bitmap.font.color
end
end
if USE_SHADOW != self.contents.font.shadow
self.contents.font.shadow = USE_SHADOW
end
end
def set_fontcolor_with_values(r,g,b)
$game_variables[FW1] = r
$game_variables[FW2] = g
$game_variables[FW3] = b
end
def set_random_fontcolor()
fc = []
3.times do
value = rand(255)
fc.push(value)
end
$game_variables[FW1] = fc[0]
$game_variables[FW2] = fc[1]
$game_variables[FW3] = fc[2]
@bitmap.font.color = Color.new(fc[0],fc[1],fc[2])
self.contents.font.color = @bitmap.font.color
end
def generate_random_color_value()
return rand(255)
end
def reset_fontcolor()
$game_variables[FW1] = STANDART_FW1
$game_variables[FW2] = STANDART_FW2
$game_variables[FW3] = STANDART_FW3
end
def take_this_pos()
$game_variables[XVAR] = self.x
$game_variables[YVAR] = self.y
update()
end
def move(moveto)
case moveto
when "up"
self.y += 1
when "down"
self.y -= 1
when "right"
self.x += 1
when "left"
self.x -= 1
end
end
def turn_off
$game_switches[SWITCH] = false
end
def turn_on
$game_switches[SWITCH] = true
end
end
Credits gehen an Gamko, den Ersteller dieses Skripts.
Changes: "Ersteller Seiten" Link funktioniert wieder.
Beispiel Projekt Link gefixt.
Großer Fehler im Skript behoben.