Jump to content

SkButton | Add Text To Buttons!


AgentGamerPro

Recommended Posts

SkButton
Add Text To Buttons!


Using this skript, you can add text to buttons with simple commands!
Permission is Text.Use

 

options:
	prefix: &3[&bSkButton&3]
	permission: Text.Use

command /text [<text>] [<text>] [<text>]:
	permission: {@permission}
  	permission message: {@prefix} &cInsufficent Permission!
	trigger:
		if arg-1 is "clearall":
			if arg-2 is not set:
				send "{@prefix} &c&lWARNING: &cDoing /text clearall will clear ALL text from ALL buttons!%nL%&7If you wish to continue, do /text clearall confirm" to player
			else if arg-2 is "confirm":
				clear {Text::*}
				send "{@prefix} &aCleared all text from all buttons!" to player
			else:
				send "{@prefix} &cIncorrect argument!" to player
		else if player's targeted block is not a button:
			send "{@prefix} &cLook at a button before using this command!" to player
		else:
			if arg-1 is not set:
				send "{@prefix} &cUsage: &b/text (add | set | delete | clear | clearall)" to player
			else if arg-1 is "add":
				if arg-2 is not set:
					send "{@prefix} &cUsage: &b/text add (text)" to player
				else:
					if arg-3 is not set:
						set {_text} to colored arg-2
						add {_text} to {Text::%location of player's targeted block%::*}
						send colored "{@prefix} &aSuccessfully added %{_text}% &ato the text!" to player
					else:
						set {_text} to colored "%arg-2% %arg-3%"
						add {_text} to {Text::%location of player's targeted block%::*}
						send colored "{@prefix} &aSuccessfully added %{_text}% &ato the text!" to player
			else if arg-1 is "set":
				if arg-2 is not set:
					send "{@prefix} &cUsage: &b/text set (line) (text)" to player
				else:
					set {_integer} to arg-2
					set {_integer} to {_integer} parsed as integer
					if {_integer} is not a integer:
						send "{@prefix} &cUsage: &b/text set (line) (text)" to player
					else:
						if arg-3 is not set:
							send "{@prefix} &cUsage: &b/text set (line) (text)" to player
						else:
							loop {Text::%location of player's targeted block%::*}:
								add 1 to {_index}
								if {_index} = {_integer}:
									set {Text::%location of player's targeted block%::%loop-index%} to colored arg-3
									set {_sendtext} to colored arg-3
									stop loop
							if {_sendtext} is set:
								send "{@prefix} &aSuccessfully set line %{_integer}% &ato %{_sendtext}%&a!" to player
							else:
								send "{@prefix} &cThat is not a line!" to player
			else if arg-1 is "delete":
				if arg-2 is not set:
					send "{@prefix} &cUsage: /text delete (line)" to player
				else:
					set {_integer} to arg-2
					set {_integer} to {_integer} parsed as integer
					if {_integer} is not a integer:
						send "{@prefix} &cUsage: &b/text delete (line)" to player
					else:
						loop {Text::%location of player's targeted block%::*}:
							add 1 to {_index}
							if {_index} = {_integer}:
								delete {Text::%location of player's targeted block%::%loop-index%}
								stop loop
						send "{@prefix} &aSuccessfully deleted line %{_integer}%&a!" to player
			else if arg-1 is "clear":
				clear {Text::%location of player's targeted block%::*}
				send "{@prefix} &aCleared all text from this button!" to player

on rightclick on button:
	loop {Text::%location of player's targeted block%::*}:
		send "%loop-value%" to player

 

Edited by AgentGamerPro
Fixed Some Bugs

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

2 hours ago, AgentGamerPro said:

SkButton
Add Text To Buttons!


Using this skript, you can add text to buttons with simple commands!
Permission is Text.Use

 

options:
	prefix: &3[&bSkButton&3]
	permission: Text.Use

command /text [<text>] [<text>] [<text>]:
	permission: {@permission}
  	permission message: {@prefix} &cInsufficent Permission!
	trigger:
		if arg-1 is "clearall":
			if arg-2 is not set:
				send "{@prefix} &c&lWARNING: &cDoing /text clearall will clear ALL text from ALL buttons!%nL%&7If you wish to continue, do /text clearall confirm" to player
			else if arg-2 is "confirm":
				clear {Text::*}
				send "{@prefix} &aCleared all text from all buttons!" to player
			else:
				send "{@prefix} &cIncorrect argument!" to player
		else if player's targeted block is not a button:
			send "{@prefix} &cLook at a button before using this command!" to player
		else:
			if arg-1 is not set:
				send "{@prefix} &cUsage: &b/text (add | set | delete | clear | clearall)" to player
			else if arg-1 is "add":
				if arg-2 is not set:
					send "{@prefix} &cUsage: &b/text add (text)" to player
				else:
					if arg-3 is not set:
						set {_text} to colored arg-2
						add {_text} to {Text::%location of player's targeted block%::*}
						send colored "{@prefix} &aSuccessfully added %{_text}% &ato the text!" to player
					else:
						set {_text} to colored "%arg-2% %arg-3%"
						add {_text} to {Text::%location of player's targeted block%::*}
						send colored "{@prefix} &aSuccessfully added %{_text}% &ato the text!" to player
			else if arg-1 is "set":
				if arg-2 is not set:
					send "{@prefix} &cUsage: &b/text set (line) (text)" to player
				else:
					set {_integer} to arg-2
					set {_integer} to {_integer} parsed as integer
					if {_integer} is not a integer:
						send "{@prefix} &cUsage: &b/text set (line) (text)" to player
					else:
						if arg-3 is not set:
							send "{@prefix} &cUsage: &b/text set (line) (text)" to player
						else:
							loop {Text::%location of player's targeted block%::*}:
								add 1 to {_index}
								if {_index} = {_integer}:
									set {Text::%location of player's targeted block%::%loop-index%} to colored arg-3
									set {_sendtext} to colored arg-3
									stop loop
							if {_sendtext} is set:
								send "{@prefix} &aSuccessfully set line %{_integer}% &ato %{_sendtext}%&a!" to player
							else:
								send "{@prefix} &cThat is not a line!" to player
			else if arg-1 is "delete":
				if arg-2 is not set:
					send "{@prefix} &cUsage: /text delete (line)" to player
				else:
					set {_integer} to arg-2
					set {_integer} to {_integer} parsed as integer
					if {_integer} is not a integer:
						send "{@prefix} &cUsage: &b/text delete (line)" to player
					else:
						loop {Text::%location of player's targeted block%::*}:
							add 1 to {_index}
							if {_index} = {_integer}:
								delete {Text::%location of player's targeted block%::%loop-index%}
								stop loop
						send "{@prefix} &aSuccessfully deleted line %{_integer}%&a!" to player
			else if arg-1 is "clear":
				clear {Text::%location of player's targeted block%::*}
				send "{@prefix} &aCleared all text from this button!" to player

on rightclick on button:
	loop {Text::%location of player's targeted block%::*}:
		send "%loop-value%" to player

 

Cool idea!

2021-06-09_20_22_08.jpg.422c39613f8b72de894e5ec1f3377dca.jpg

Yo who actually reads these

[Vip] - 12/29/2020
[Pro] - 1/25/2022
 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...