Skocz do zawartości
  • 0

MrGoraj

Pytanie

Witam dało by się jakoś zoptymalizować lepiej ten fragment kodu ponieważ da się odczuć lekkie lagi przy teleportacji czasami

 

			if {mapa} is 4:
				teleport player to {metro1blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {kanaly1blue}
				if {_random} is 2:
					teleport player to {kanaly2blue}
				if {_random} is 3:
					teleport player to {kanaly3blue}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {pustynia1blue}
				if {_random} is 2:
					teleport player to {pustynia2blue}
				if {_random} is 3:
					teleport player to {pustynia3blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {ziba1blue}
				if {_random} is 2:
					teleport player to {ziba2blue}
				if {_random} is 3:
					teleport player to {ziba3blue}

 

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/
Udostępnij na innych stronach

9 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

To tylko fragment całego kodu, skąd masz pewność, że to właśnie on jest przyczyną problemu? Zresztą odczuwam wrażenie, jakoby ciężko było cokolwiek wyczytać z takiego lakonicznego kawałka. Coś o kolejkach, nie widzę powodu, dla którego ten fragment miałby wytwarzać lagi - są znacznie bardziej zaawansowane skrypty, które wcale nie posiadają lagów. Może to wina VPS-a?

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102300
Udostępnij na innych stronach

  • 0
on rightclick on sign:
	if line 1 is "wsparcie":	
		execute console command "shot give %player% wsparcie 1"
		execute console command "shot give %player% granat 3"
		execute console command "shot give %player% flashbang 3"
		give player 350 coal
		if has permission "permission.blue":
			equip player with all leather armour
			dye player's helmet blue
			dye player's chestplate blue
			dye player's leggings blue
			dye player's boots blue
			equip player with all leather armour
			dye player's helmet blue
			dye player's chestplate blue
			dye player's leggings blue
			dye player's boots blue
			if {mapa} is 4:
				teleport player to {metro1blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {kanaly1blue}
				if {_random} is 2:
					teleport player to {kanaly2blue}
				if {_random} is 3:
					teleport player to {kanaly3blue}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {pustynia1blue}
				if {_random} is 2:
					teleport player to {pustynia2blue}
				if {_random} is 3:
					teleport player to {pustynia3blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {ziba1blue}
				if {_random} is 2:
					teleport player to {ziba2blue}
				if {_random} is 3:
					teleport player to {ziba3blue}
		if has permission "permission.red":	
			equip player with all leather armour
			dye player's helmet blue
			dye player's chestplate blue
			dye player's leggings blue
			dye player's boots blue
			if {mapa} is 1:
				teleport player to {metro1red}
			if {mapa} is 2:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {kanaly1red}
				if {_random} is 2:
					teleport player to {kanaly2red}
				if {_random} is 3:
					teleport player to {kanaly3red}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {pustynia1red}
				if {_random} is 2:
					teleport player to {pustynia2red}
				if {_random} is 3:
					teleport player to {pustynia3red}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				if {_random} is 1:
					teleport player to {ziba1red}
				if {_random} is 2:
					teleport player to {ziba2red}
				if {_random} is 3:
					teleport player to {ziba3red}

Daje kod jednej z klas.

Właśnie VPS nie jest wykorzystywany nawet w 30% a lagi i tak są odczuwalne

Dziwi mnie również to że na lagi skarży się część graczy a część zapytana o to mówi że żadnych nie ma (nie nie jest to wina łącza czy komputera bo nawet osoby z bardzo dobrymi podzespołowymi je odczuwają)

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102302
Udostępnij na innych stronach

  • 0
Spoiler

			if {mapa} is 4:
				teleport player to {metro1blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {kanaly%{_random}%blue}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				teleport player to {pustynia%{_random}%blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {ziba%{_random}%blue}

 

Co masz na myśli mówiąc "lagi przy teleporcie"?

Wyłapałem błąd w sk :V, masz 2x if {mapa} is 1 (zmienne kanaly oraz ziba).

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102364
Udostępnij na innych stronach

  • 0
Dnia 29.11.2016 o 18:50, ICD10 napisał:

Spróbuj pozamieniać wszystkie zmienne lokalne {_random} na np. chance of 25%.

Nie pomogło

Dnia 29.11.2016 o 23:37, Switsherker napisał:
  Pokaż ukrytą zawartość


			if {mapa} is 4:
				teleport player to {metro1blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {kanaly%{_random}%blue}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				teleport player to {pustynia%{_random}%blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {ziba%{_random}%blue}

 

Co masz na myśli mówiąc "lagi przy teleporcie"?

Wyłapałem błąd w sk :V, masz 2x if {mapa} is 1 (zmienne kanaly oraz ziba).

trzeba odczekać chwile inaczej cie cofa lub masz opóźnienia zresztą możesz zobaczyć wchodząc na [IP ~Derpy]

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102782
Udostępnij na innych stronach

  • 0
1 minutę temu, ICD10 napisał:

No to pewnie wina VPS-a, podaj specyfikację procesora.

https://www.ovh.pl/vps/vps-ssd.xml

SSD2

Jakby lagi występowały ogólnie to też bym tak podejrzewał jednak są one tylko i wyłącznie w momencie teleportacji

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102787
Udostępnij na innych stronach

  • 0
			if {mapa} is 4:
				teleport player to {metro1blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {kanaly%{_random}%blue}
			if {mapa} is 3:
				set {_random} to a random integer between 1 and 3
				teleport player to {pustynia%{_random}%blue}
			if {mapa} is 1:
				set {_random} to a random integer between 1 and 3
				teleport player to {ziba%{_random}%blue}

Masz.

Odnośnik do komentarza
https://skript.pl/temat/14829-optymalizacja/#findComment-102842
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

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