Frombase (Function) — Skript

Addon: Skript · Category: Function

Syntax

fromBase(string value: objects, base: long) :: longs

Description

Turns a text version of a number in a specific base (decimal, hexadecimal, octal) into an actual number. For example, converting "20" in hexadecimal (base 16) would be 'fromBase("20", 16)', which would return 32. You can use any base between 2 and 36.

Examples

# /binaryText 01110011 01101011 01110010 01101001 01110000 01110100 00100001
# sends "skript!"
command binaryText <text>:
	trigger:
	set {_characters::*} to argument split at " " without trailing empty string
		transform {_characters::*} with fromBase(input, 2) # convert to codepoints
		transform {_characters::*} with character from codepoint input # convert to characters
		send join {_characters::*}

View source