Skocz do zawartości
  • 0

jak na podstawie minut otrzymać godziny i minuty


Scroll ツ
 Udostępnij

Pytanie

2 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
command /czas [<text>]:
	trigger:
		if arg 1 is not set:
			send "&cPodaj liczbe calkowita."
			stop
		set {_poczatek} to arg 1
		set {_poczatek} to {_poczatek} parsed as integer
		if {_poczatek} is integer:
			if {_poczatek} is smaller than 60:
				if {_poczatek} is 1:
					send "&c%{_poczatek}% sekunda"
					stop
				if {_poczatek} is 2 or 3 or 4:
					send "&c%{_poczatek}% sekundy"
					stop
				send "&c%{_poczatek}% sekund"
				stop
			if {_poczatek} is larger than 59:
				if {_poczatek} is larger than 3599:
					#Hours
					set {_m} to "%{_poczatek} / 60%"
					loop length of {_m} times:
						if subtext of {_m} from characters loop-number to loop-number is ".":
							set {_m} to first loop-number - 1 characters of {_m}
							exit loop
					set {_m} to {_m} parsed as integer
					set {_s} to "%60 * {_m}%"
					set {_s} to {_s} parsed as integer
					set {_s} to "%{_poczatek} - {_s}%"
					set {_s} to {_s} parsed as integer
					set {_h} to "%{_m} / 60%"
					loop length of {_h} times:
						if subtext of {_h} from character loop-number to loop-number is ".":
							set {_h} to first loop-number - 1 characters of {_h}
							exit loop
					set {_h} to {_h} parsed as integer
					set {_m} to "%{_m} - (60 * {_h})%"
					set {_m} to {_m} parsed as integer
					set {_sk} to ""
					if {_s} is 1:
						set {_sk} to "a"
					if {_s} is 2 or 3 or 4:
						set {_sk} to "y"
					set {_mk} to ""
					if {_m} is 1:
						set {_mk} to "a"
					if {_m} is 2 or 3 or 4:
						set {_mk} to "y"
					set {_hk} to ""
					if {_h} is 1:
						set {_hk} to "a"
					if {_h} is 2 or 3 or 4:
						set {_hk} to "y"
					set {_mko} to ""
					if {_m} is larger than 0:
						set {_mko} to ", %{_m}% minut%{_mk}%"
					set {_sko} to ""
					if {_s} is larger than 0:
						set {_sko} to ", %{_s}% sekund%{_sk}%"
					set {_koniec} to "%{_h}% godzin%{_hk}%%{_mko}%%{_sko}%"
					send "&6%{_poczatek}% &7sekund to &c%{_koniec}%"
					stop
				#Minutes
				set {_m} to "%{_poczatek} / 60%"
				loop length of {_m} times:
					if subtext of {_m} from characters loop-number to loop-number is ".":
						set {_m} to first loop-number - 1 characters of {_m}
						exit loop
				set {_m} to {_m} parsed as integer
				set {_s} to "%60 * {_m}%"
				set {_s} to {_s} parsed as integer
				set {_s} to "%{_poczatek} - {_s}%"
				set {_s} to {_s} parsed as integer
				set {_sk} to ""
				if {_s} is 1:
					set {_sk} to "a"
				if {_s} is 1 or 2 or 3 or 4:
					set {_sk} to "y"
				set {_mk} to ""
				if {_m} is 1:
					set {_mk} to "a"
				if {_m} is 2 or 3 or 4:
					set {_mk} to "y"
				set {_sko} to ""
				if {_s} is larger than 0:
					set {_sko} to ", %{_s}% sekund%{_sk}%"
				set {_mko} to ""
				set {_mko} to "%{_m}% minut%{_mk}%"
				set {_koniec} to "%{_mko}%%{_sko}%"
				send "&6%{_poczatek}% &7sekund to &c%{_koniec}%"
				stop

 

Skrypt autorstwa knugiego.

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
command /minuty [<number>]:
	trigger:
  		if arg 1 >= 60:
          	set {_x} to arg 1
  			set {_x} to {_x}/60
  			set {_x} to rounded {_x}
  			set {_y} to {_x}*60
  			set {_z} to arg 1
  			set {_z} to {_z}-{_y}
          	send "&6%arg 1% minut &7to: &6{_x} godzin &7i &6{_z} minut&7!"

Wytabuj, bo edytor jest zjeb*ny.

Edytowane przez KrejzolekPRO
Odnośnik do komentarza
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...