X [WIP] [Game] [V0.4]
An RPG game I'm working on...it's going to take awhile for me to finish this.
Spoiler
Code (All Versions):
V0.4 http://pastebin.com/0QXxXWuZ
V0.3 http://pastebin.com/mNN4KzHx
V0.2 http://pastebin.com/CqZGwt7S
V0.1 http://pastebin.com/Mc9zJfhU
Video (V0.5):
How to get (Latest Version):
Code (All Versions):
V0.4 http://pastebin.com/0QXxXWuZ
V0.3 http://pastebin.com/mNN4KzHx
V0.2 http://pastebin.com/CqZGwt7S
V0.1 http://pastebin.com/Mc9zJfhU
Video (V0.5):
How to get (Latest Version):
>pastebin get 0QXxXWuZ X
XUtils [API] [V1.2]
An API I'm working on, will help with X.
Spoiler
Code (All Working Versions):
V1.2: http://pastebin.com/PAiYZRuZ
V1.1: http://pastebin.com/Z05xWxyJ
Demonstrations (Latest Version):
1. "Clear" Background
Documentation (Latest Version):
xutils.init()
How to get (Latest Version):
Code (All Working Versions):
V1.2: http://pastebin.com/PAiYZRuZ
V1.1: http://pastebin.com/Z05xWxyJ
Demonstrations (Latest Version):
1. "Clear" Background
Spoiler
Documentation (Latest Version):
xutils.init()
Spoiler
Use this to inititialize your screen for modification.
Arguments:
None.
Returns:
tScreen = xutils.init()
tScreen = your initialized screen variable.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Hi", 1, 1, colors.red)
xutils.render(tScreen)
Note:
Unless you are experienced with handling more than one screen, make
sure to use the variable that you initialized your screen with all
of your xutils functions in that program.
function extract(tColors, ...)
_ = {}
for i=1, 3 do _ = string.sub(tColors[arg[1]][arg[2]], i, i) end
return _[1], _[2], _[3]
end
xutils.extract()Use this to inititialize your screen for modification.
Arguments:
None.
Returns:
tScreen = xutils.init()
tScreen = your initialized screen variable.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Hi", 1, 1, colors.red)
xutils.render(tScreen)
Note:
Unless you are experienced with handling more than one screen, make
sure to use the variable that you initialized your screen with all
of your xutils functions in that program.
function extract(tColors, ...)
_ = {}
for i=1, 3 do _ = string.sub(tColors[arg[1]][arg[2]], i, i) end
return _[1], _[2], _[3]
end
Spoiler
Use this to extract and interpret data from any pixel of your initialized
screen variable.
Arguments:
xutils.extract(tScreen, x, y)
tScreen = your initialized screen variable.
x = x-coordinate of the extraction pixel.
y = y-coordinate of the extraction pixel.
Returns:
background_color, text_color, text = xutils.extract(tScreen, x, y)
background_color = background color of that pixel.
text_color = text color of that pixel.
text = text that is on that pixel.
Example Usage:
tScreen = xutils.init()
_, _, text = xutils.extract(tScreen, 1, 1)
print('The text that is on pixel (1, 1) is "'..text..'"')
Note:
The values of the background and text colors are in Hexadecimal and 2 is
not put to the power of them.
This does not actually alter the values, it just returns them.
If your screen was just initialized, your text and background colors will
be white and the text will be " ".
xutils.insert()Use this to extract and interpret data from any pixel of your initialized
screen variable.
Arguments:
xutils.extract(tScreen, x, y)
tScreen = your initialized screen variable.
x = x-coordinate of the extraction pixel.
y = y-coordinate of the extraction pixel.
Returns:
background_color, text_color, text = xutils.extract(tScreen, x, y)
background_color = background color of that pixel.
text_color = text color of that pixel.
text = text that is on that pixel.
Example Usage:
tScreen = xutils.init()
_, _, text = xutils.extract(tScreen, 1, 1)
print('The text that is on pixel (1, 1) is "'..text..'"')
Note:
The values of the background and text colors are in Hexadecimal and 2 is
not put to the power of them.
This does not actually alter the values, it just returns them.
If your screen was just initialized, your text and background colors will
be white and the text will be " ".
Spoiler
Use this to insert data into any pixel of your initialized screen variable.
Arguments:
xutils.insert(tScreen, text, text_color, background_color, x, y)
tScreen = your initialized screen variable.
text = text you are putting in.
text_color = text color of your text.
background_color = background color of the pixel.
x = x-coordinate of the pixel.
y = y-coordinate of the pixel.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.insert(tScreen, "-", e, 6, 1, 1)
xutils.render(tScreen)
Note:
The values of the background and text colors must be in Hexadecimal and
2 should not be put to the power of them.
xutils.text()Use this to insert data into any pixel of your initialized screen variable.
Arguments:
xutils.insert(tScreen, text, text_color, background_color, x, y)
tScreen = your initialized screen variable.
text = text you are putting in.
text_color = text color of your text.
background_color = background color of the pixel.
x = x-coordinate of the pixel.
y = y-coordinate of the pixel.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.insert(tScreen, "-", e, 6, 1, 1)
xutils.render(tScreen)
Note:
The values of the background and text colors must be in Hexadecimal and
2 should not be put to the power of them.
Spoiler
Equivalent of "write()" in the XUtils API.
Arguments:
xutils.text(tScreen, text, x, y, [text_color, background_color])
tScreen = your initialized screen variable.
text = what you are writing.
x = x-coordinate of the start of the text.
y = y-coordinate of text.
text_color = text color of the text, nil if the text will adopt the
text color that is already in the pixel(s).
background_color = background color of the text, nil if the text
will adopt the background color that is already in the pixel(s).
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Hello World", 1, 1, colors.red)
xutils.render(tScreen)
Note:
Will error if the string is too long to be portrayed within a 51 by 19
pixel space, given the x and y arguments of the function.
xutils.color()Equivalent of "write()" in the XUtils API.
Arguments:
xutils.text(tScreen, text, x, y, [text_color, background_color])
tScreen = your initialized screen variable.
text = what you are writing.
x = x-coordinate of the start of the text.
y = y-coordinate of text.
text_color = text color of the text, nil if the text will adopt the
text color that is already in the pixel(s).
background_color = background color of the text, nil if the text
will adopt the background color that is already in the pixel(s).
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Hello World", 1, 1, colors.red)
xutils.render(tScreen)
Note:
Will error if the string is too long to be portrayed within a 51 by 19
pixel space, given the x and y arguments of the function.
Spoiler
Pixel/Rectangle drawer, the main method of background color manipulation
in the XUtils API.
Arguments:
xutils.color(tScreen, background_color, x1, y1, [x2, y2])
tScreen = your initialized screen variable.
background_color = color of what you're drawing.
x1 = x-coordinate of the pixel/corner of the rectangle.
y1 = y-coordinate of the pixel/corner of the rectangle.
x2 = x-coordinate of the opposite corner of the rectangle.
y2 = y-coordinate of the opposite corner of the rectangle.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.color(tScreen, colors.red, 1, 1, 5, 5)
xutils.render(tScreen)
Note:
Will error if any of the x-coordinates are not within 1 to 51 and if
any of the y-coordinates are not within 1 to 19.
xutils.render()Pixel/Rectangle drawer, the main method of background color manipulation
in the XUtils API.
Arguments:
xutils.color(tScreen, background_color, x1, y1, [x2, y2])
tScreen = your initialized screen variable.
background_color = color of what you're drawing.
x1 = x-coordinate of the pixel/corner of the rectangle.
y1 = y-coordinate of the pixel/corner of the rectangle.
x2 = x-coordinate of the opposite corner of the rectangle.
y2 = y-coordinate of the opposite corner of the rectangle.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.color(tScreen, colors.red, 1, 1, 5, 5)
xutils.render(tScreen)
Note:
Will error if any of the x-coordinates are not within 1 to 51 and if
any of the y-coordinates are not within 1 to 19.
Spoiler
Renders the initialized screen variable onto the screen.
Arguments:
xutils.render(tScreen)
tScreen = your initialized screen variable.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Rendered stuffs", 1, 1)
xutils.render(tScreen)
xutils.unload()Renders the initialized screen variable onto the screen.
Arguments:
xutils.render(tScreen)
tScreen = your initialized screen variable.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.text(tScreen, "Rendered stuffs", 1, 1)
xutils.render(tScreen)
Spoiler
Use this to save screen variables in files.
Arguments:
xutils.unload(tScreen, path)
tScreen = your initialized screen variable.
path = file you want to save the screen variable to.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.unload(tScreen, "MyBlankFile")
xutils.load()Use this to save screen variables in files.
Arguments:
xutils.unload(tScreen, path)
tScreen = your initialized screen variable.
path = file you want to save the screen variable to.
Returns:
nil.
Example Usage:
tScreen = xutils.init()
xutils.unload(tScreen, "MyBlankFile")
Spoiler
Use this to initialize a screen variable from a file.
Arguments:
xutils.load(path)
path = file your screen is saved on.
Returns:
tScreen = xutils.load()
tScreen = your initialized screen variable.
Example Usage:
tScreen = xutils.load(CatPicture)
xutils.render(tScreen)
Use this to initialize a screen variable from a file.
Arguments:
xutils.load(path)
path = file your screen is saved on.
Returns:
tScreen = xutils.load()
tScreen = your initialized screen variable.
Example Usage:
tScreen = xutils.load(CatPicture)
xutils.render(tScreen)
How to get (Latest Version):
>pastebin get PAiYZRuZ xutils
>lua
Interactive Lua prompt.
Call exit() to exit.
lua>os.loadAPI("xutils")
lua>exit()
Feedback is very much appreciated on any of the above! Thanks


This topic is locked









