Aller au contenu
  • 0

Raccourcir mon Skript


Question

Posté(e)

Version de Minecraft : 1.12.2

Addons utilisés: Tuske (j'en ai d'autres mais dans ce skript, il me semble qu'ils sont inutiles, si vous voulez la liste entière malgré tout, précisez le moi^^)

Type du skript : Raccourcir un skript pour éviter qu'il s'étale sur des centaines de lignes

Description du script :

Salut à quiconque lira ce sujet 😄 

Tout d'abord, je tiens à préciser que je ne savais pas vraiment où posté ceci comme je demande *en quelque sorte* de refaire mon skript , mais comme j'avais déjà fait le skript, je pense que le mieux était donc de considéré ça comme une demande d'aide 🙂 .

J'aimerais savoir si quelqu'un aurait une idée de comment raccourcir ce skript:

Révélation

	if {lundi6} is not set:
				format gui slot 14 of player with redstone named "&cCours non définis pour la journée" to nothing
			else:
#lundi 1
				if %{lundi1}% is "Anglais":
					format gui slot 11 of player with yellow wool named "&e%{lundi1}%" to nothing
				else if %{lundi1}%% is "Espagnol":
					format gui slot 11 of player with orange wool named "&6%{lundi1}%" to nothing
				else if %{lundi1}% is "Francais":
					format gui slot 11 of player with cyan wool named "&3%{lundi1}%" to nothing
				else if %{lundi1}% is "SVT":
					format gui slot 11 of player with lime wool named "&a%{lundi1}%" to nothing
				else if %{lundi1}% is "HistoireGeo":
					format gui slot 11 of player with blue wool named "&9%{lundi1}%" to nothing
				else if %{lundi1}% is "PhysiqueChimie":
					format gui slot 11 of player with purple wool named "&5%{lundi1}%" to nothing
				else if %{lundi1}% is "EPS":
					format gui slot 11 of player with pink wool named "&d%{lundi1}%" to nothing
				else if %{lundi1}% is "Maths":
					format gui slot 11 of player with red wool named "&c%{lundi1}%" to nothing
				else if %{lundi1}% is "Perm":
					format gui slot 11 of player with white wool named "&f%{lundi1}%" to nothing

 

Pour ceux qui se demandent, il s'agit d'un skript RP, permettant d'avoir un système d'emploi du temps personnalisé !

(Le skript est censé fonctionné)

Dans cette partie, je demande au skript de détecter si le cours est en premier lieu, de l'anglais, puis de l'espagnol ... Le soucis c'est que je dois faire ça pour 6cours dans une journée sachant qu'il y a 5jours de cours (voire 4 si je souhaite diminuer). Et donc vous vous doutez que de voir ce code copié collé 6x5 (donc 30 fois) , bah ca va piquer les yeux 😕 .

/!\ Petites infos à savoir  : -la variable {lundi1} correspond au premier cours du lundi , le dernier étant {lundi6}.                                                                                                                                                                                            -le slot 11 correspond donc uniquement à un seul et unique cours, les 5 autres cours sont dispersés sur les slots 12; 13; 15; 16 et 17                                                                                                      -les variables {lundi1} {lundi2}... sont définies grâce à cette commande:

Révélation

command /modifEDT <text> <text> <text> <text> <text> <text> <text>:
	permission: prof.modifEDT
	trigger:
		if arg-1 is "lundi":
  ####
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChimie" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {lundi1} to arg-2
				set {lundi2} to arg-3
				set {lundi3} to arg-4
				set {lundi4} to arg-5
				set {lundi5} to arg-6
				set {lundi6} to arg-7

 

(Moins important mais autant l'inclure ici, si vous avez un moyen de raccourcir aussi cette commande (en particulier la partie après les #### car elle aussi est récopiée 4fois de plus pour les 4 autres jours) en gardant toujours son utilité, je ne suis pas contre 🤷‍♂️ )

 

Voici donc pour cette demande, si vous avez d'autres besoins, par exemple au niveau de l'explication du skript, de son comportement etc... ,n'hésitez pas à me demander 😋

 

13 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Excuse moi de mon ignorance mais,

je suis tout nouveau dans le monde du skript, pour bien me renseigner et éviter de bacler mon programme, existe t-il un tutoriel sur les fonctions ? Si oui, pourrais-tu m'en faire part? :v 

 

  • 0
Posté(e)
Il y a 11 heures, Metsuu a dit :

if %{lundi1}% is "Anglais":

il faudrait dans un premier temps savoir se servir des pourcentages. Les pourcentages sont à utiliser uniquement pour retranscrire un object en string. Ta variable semblant être déjà un string, alors les pourcentages autour dans ce genre de conditions deviennent inutiles.

  • 0
Posté(e) (modifié)

Exact, je sais que ici, les % sont inutiles, mais j'ai fait ce post en très peu de temps, donc dans la précipitation, je fait une erreur 😕 

Je reste toujours assez perdu au niveau des fonctions, n' existe t-il pas un post consacré à l'apprentissage des fonctions sur ce forum? :c 

Ou alors si vous pouviez me guider sur la manière donc réaliser ce skript grâce à des fonctions ça me convient également ^^

 

 

Je ne vois pas comment faire pour que le programme détecte par exemple que la variable {lundi1} correspond à un cours de Maths, alors il met automatiquement l'item du gui sur une laine rouge et l'appelle {lundi1} en rouge également (car la couleur de la laine et la couleur du cours diffère selon la matière), sans devoir demandé chaque cours un par un. 

Modifié par Metsuu
  • 0
Posté(e)
Il y a 4 heures, Metsuu a dit :

mais j'ai fait ce post en très peu de temps, donc dans la précipitation, je fait une erreur

Si tu ne nous donnes pas le code tel quel que tu as fait, nous ne pourrons pas t'aider efficacement.

  • 0
Posté(e) (modifié)
Révélation

 


command /modifEDT <text> <text> <text> <text> <text> <text> <text>:
	permission: prof.modifEDT
	trigger:
		if arg-1 is "lundi":
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChimie" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {lundi1} to arg-2
				set {lundi2} to arg-3
				set {lundi3} to arg-4
				set {lundi4} to arg-5
				set {lundi5} to arg-6
				set {lundi6} to arg-7
		if arg-1 is "mardi":
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChime" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {mardi1} to arg-2
				set {mardi2} to arg-3
				set {mardi3} to arg-4
				set {mardi4} to arg-5
				set {mardi5} to arg-6
				set {mardi6} to arg-7
		if arg-1 is "mercredi":
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChime" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {mercredi1} to arg-2
				set {mercredi2} to arg-3
				set {mercredi3} to arg-4
				set {mercredi4} to arg-5
				set {mercredi5} to arg-6
				set {mercredi6} to arg-7
		if arg-1 is "jeudi":
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChime" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {jeudi1} to arg-2
				set {jeudi2} to arg-3
				set {jeudi3} to arg-4
				set {jeudi4} to arg-5
				set {jeudi5} to arg-6
				set {jeudi6} to arg-7
		if arg-1 is "vendredi":
			if arg-2 or arg-3 or arg-4 or arg-5 or arg-6 or arg-7 is not "Francais" or "Anglais" or "Espagnol" or "PhysiqueChime" or "SVT" or "HistoireGeo" or "EPS" or "Maths" or "Perm":
				send ""
				send "&cL'un des cours n'est pas reconnu, veuillez faire /cours pour voir les cours connus"
				send ""
			else:
				set {vendredi1} to arg-2
				set {vendredi2} to arg-3
				set {vendredi3} to arg-4
				set {vendredi4} to arg-5
				set {vendredi5} to arg-6
				set {vendredi6} to arg-7
		if arg-1 is not "lundi" or "mardi" or "mercredi" or "jeudi" or "vendredi":
			send ""
			send "&cIl faut préciser la journée. &2Ex: /modifEDT lundi"
			send ""

Voici pour ce qui est du set des variables

et pour la détection des cours :

Révélation

 


#lundi 1
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi1} is "Anglais":
					format gui slot 11 of player with yellow wool named "&e%{lundi1}%" to nothing
				else if {lundi1} is "Espagnol":
					format gui slot 11 of player with orange wool named "&6%{lundi1}%" to nothing
				else if {lundi1} is "Francais":
					format gui slot 11 of player with cyan wool named "&3%{lundi1}%" to nothing
				else if {lundi1} is "SVT":
					format gui slot 11 of player with light green wool named "&a%{lundi1}%" to nothing
				else if {lundi1} is "HistoireGeo":
					format gui slot 11 of player with blue wool named "&9%{lundi1}%" to nothing
				else if {lundi1} is "PhysiqueChimie":
					format gui slot 11 of player with purple wool named "&5%{lundi1}%" to nothing
				else if {lundi1} is "EPS":
					format gui slot 11 of player with pink wool named "&d%{lundi1}%" to nothing
				else if {lundi1} is "Maths":
					format gui slot 11 of player with red wool named "&c%{lundi1}%" to nothing
				else if {lundi1} is "Perm":
					format gui slot 11 of player with white wool named "&f%{lundi1}%" to nothing
#Lundi2
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi2} is "Anglais":
					format gui slot 12 of player with yellow wool named "&e%{lundi2}%" to nothing
				else if {lundi2} is "Espagnol":
					format gui slot 12 of player with orange wool named "&6%{lundi2}%" to nothing
				else if {lundi2} is "Francais":
					format gui slot 12 of player with cyan wool named "&3%{lundi2}%" to nothing 
				else if {lundi2} is "SVT":
					format gui slot 12 of player with light green wool named "&a%{lundi2}%" to nothing 
				else if {lundi2} is "HistoireGeo":
					format gui slot 12 of player with blue wool named "&9%{lundi2}%" to nothing 
				else if {lundi2} is "PhysiqueChimie":
					format gui slot 12 of player with purple wool named "&5%{lundi2}%" to nothing
				else if {lundi2} is "EPS":
					format gui slot 12 of player with pink wool named "&d%{lundi2}%" to nothing
				else if {lundi2} is "Maths":
					format gui slot 12 of player with red wool named "&c%{lundi2}%" to nothing
				else if {lundi2} is "Perm":
					format gui slot 12 of player with white wool named "&f%{lundi2}%" to nothing
#lundi3	
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi3} is "Anglais":
					format gui slot 13 of player with yellow wool named "&e%{lundi3}%" to nothing
				else if {lundi3} is "Espagnol":
					format gui slot 13 of player with orange wool named "&6%{lundi3}%" to nothing
				else if {lundi3} is "Francais":
					format gui slot 13 of player with cyan wool named "&3%{lundi3}%" to nothing 
				else if {lundi3} is "SVT":
					format gui slot 13 of player with light green wool named "&a%{lundi3}%" to nothing 
				else if {lundi3} is "HistoireGeo":
					format gui slot 13 of player with blue wool named "&9%{lundi3}%" to nothing 
				else if {lundi3} is "PhysiqueChimie":
					format gui slot 13 of player with purple wool named "&5%{lundi3}%" to nothing
				else if {lundi3} is "EPS":
					format gui slot 13 of player with pink wool named "&d%{lundi3}%" to nothing
				else if {lundi3} is "Maths":
					format gui slot 13 of player with red wool named "&c%{lundi3}%" to nothing
				else if {lundi3} is "Perm":
					format gui slot 13 of player with white wool named "&f%{lundi3}%" to nothing
#lundi4
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi4} is "Anglais":
					format gui slot 15 of player with yellow wool named "&e%{lundi4}%" to nothing
				else if {lundi4} is "Espagnol":
					format gui slot 15 of player with orange wool named "&6%{lundi4}%" to nothing
				else if {lundi4} is "Francais":
					format gui slot 15 of player with cyan wool named "&3%{lundi4}%" to nothing 
				else if {lundi4} is "SVT":
					format gui slot 15 of player with light green wool named "&a%{lundi4}%" to nothing 
				else if {lundi4} is "HistoireGeo":
					format gui slot 15 of player with blue wool named "&9%{lundi4}%" to nothing 
				else if {lundi4} is "PhysiqueChimie":
					format gui slot 15 of player with purple wool named "&5%{lundi4}%" to nothing
				else if {lundi4} is "EPS":
					format gui slot 15 of player with pink wool named "&d%{lundi4}%" to nothing
				else if {lundi4} is "Maths":
					format gui slot 15 of player with red wool named "&c%{lundi4}%" to nothing
				else if {lundi4} is "Perm":
					format gui slot 15 of player with white wool named "&f%{lundi4}%" to nothing
#lundi5
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi5} is "Anglais":
					format gui slot 16 of player with yellow wool named "&e%{lundi5}%" to nothing
				else if {lundi5} is "Espagnol":
					format gui slot 16 of player with orange wool named "&6%{lundi5}%" to nothing
				else if {lundi5} is "Francais":
					format gui slot 16 of player with cyan wool named "&3%{lundi5}%" to nothing 
				else if {lundi5} is "SVT":
					format gui slot 16 of player with light green wool named "&a%{lundi5}%" to nothing 
				else if {lundi5} is "HistoireGeo":
					format gui slot 16 of player with blue wool named "&9%{lundi5}%" to nothing 
				else if {lundi5} is "PhysiqueChimie":
					format gui slot 16 of player with purple wool named "&5%{lundi5}%" to nothing
				else if {lundi5} is "EPS":
					format gui slot 16 of player with pink wool named "&d%{lundi5}%" to nothing
				else if {lundi5} is "Maths":
					format gui slot 16 of player with red wool named "&c%{lundi5}%" to nothing
				else if {lundi5} is "Perm":
					format gui slot 16 of player with white wool named "&f%{lundi5}%" to nothing
#lundi6				
				format gui slot 14 of player with mushroom stew named "&7Repas" to nothing
				if {lundi6} is "Anglais":
					format gui slot 17 of player with yellow wool named "&e%{lundi6}%" to nothing
				else if {lundi6} is "Espagnol":
					format gui slot 17 of player with orange wool named "&6%{lundi6}%" to nothing
				else if {lundi6} is "Francais":
					format gui slot 17 of player with cyan wool named "&3%{lundi6}%" to nothing 
				else if {lundi6} is "SVT":
					format gui slot 17 of player with light green wool named "&a%{lundi6}%" to nothing 
				else if {lundi6} is "HistoireGeo":
					format gui slot 17 of player with blue wool named "&9%{lundi6}%" to nothing 
				else if {lundi6} is "PhysiqueChimie":
					format gui slot 17 of player with purple wool named "&5%{lundi6}%" to nothing
				else if {lundi6} is "EPS":
					format gui slot 17 of player with pink wool named "&d%{lundi6}%" to nothing
				else if {lundi6} is "Maths":
					format gui slot 17 of player with red wool named "&c%{lundi6}%" to nothing
				else if {lundi6} is "Perm":
					format gui slot 17 of player with white wool named "&f%{lundi6}%" to nothing

Si vous avez besoin de plus d'infos, je mets mon discord là au cas où: Metsuu#6718

Modifié par Metsuu
  • 0
Posté(e)

Toujours pas eu de nouvelles réponses,

ma tâche doit être trop compliqué ? 

Enfin bref, du fait, toujours d'actualité. Si une une personne douée en functions voit ce post, j'suis pas trop contre une aide pour pouvoir le passer en résolu :^ 

 

  • 0
Posté(e)
Le 30/09/2019 à 00:25, Vengelis_ a dit :

Salut,

J'ai lu en diagonal ton topique, j'y regarderai dans l'après midi pour t'expliquer les fonctions ^^

Cordialement.

Merci ^^'

 

  • 0
Posté(e)
Le 30/09/2019 à 00:25, Vengelis_ a dit :

Salut,

J'ai lu en diagonal ton topique, j'y regarderai dans l'après midi pour t'expliquer les fonctions ^^

Cordialement.

Elle est longue ton après midi hihi =P

  • 0
Posté(e)

Bonsoir,

Je vous invite à mettre en étiquette tout en haut à gauche de ce sujet "résolu" si votre demande est terminée sinon vous pouvez préciser votre problème.

Bonne soirée

Invité
Ce sujet ne peut plus recevoir de nouvelles réponses.
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.