Introduction
Ever getting tired of needing to rewrite the same piece of code over and over again for either every game or you just forget to put general functions in a module for re-use? see that as no more!
I’m introducing to you:
Void’s Easy-Scripters Framework
This framework has all the standard usable functions built into one to be used whenever you want to. The best part about the module is that it comes with a plugin that notifies you when the module has an available update.
Just with 1 click on a button you update the module fully and you do not need to get back into the toolbox to grab it and insert it. isn’t that nifty?
This framework is compatible for both Local and server sided coding. They won’t communicate through it so don’t worry about where it’s located at the moment.
Usage
The base for all of it
Every script should contain at least these 2 lines at the top of the script:
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
This both grabs and requires the module and gives you the auto completion for the services via the Base
variable.
Documentation
Data and Dictionaries
:GetDataService()
Function of: Module.Init
Description:
This function returns the full module from on the framework regarding all the functions that can be used. Without any effort you can either; search something within sub dictionaries of a dictionary or fully handle data from datastores without the need of writing all the code yourself.
Returns
Return Type | Summary | |||
---|---|---|---|---|
Table | The functions that are attached to the called function |
:GetDataStoreAsync()
Function of: GetDataService
Description:
This function returns the data from the specified key and datastore with an optional scope when defined as ordered.
Parameters
Name | Type | Default | Description |
---|---|---|---|
Name | String | ||
Key | String | The key identifying the entry being retrieved from the data store | |
Ordered | Bool | ||
Scope | String | global |
Returns
Return Type | Summary |
---|---|
Variant | The table/Value from the specified key and Datastore. This is nil if nothing is found. |
Code Samples
Basic Usage
Getting the date safely and without any hassle.
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local DataService = Base:GetDataService()
local Datastore, key, Ordered, scope = "plrData", 1, false, nil
local success, data = DataService:GetDataStoreAsync(Datastore, key, Ordered, scope)
if success then
print(data)
end
:UpdateDataStoreAsync()
Function of: GetDataService
Description:
Updates the datastore using Datastore:UpdateAsync() except with easier access
Parameters
Name | Type | Default | Description |
---|---|---|---|
Datastore | String | ||
Key | String | The key identifying the entry being retrieved from the data store. | |
Ordered | Bool | ||
Scope | String | ||
Transform Function | Function | A function which you need to provide. The function takes the key’s old value as input and returns the new value. |
Returns
Return Type | Summary |
---|---|
bool | Whenever the update has been successful |
Code Samples
Updating data
This demonstrates how to update data safely and properly.
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local DataService = Base:GetDataService()
function UpdateData(oldData)
local newValue = oldValue or 0
newValue = newValue + 50
return newValue
end
local success = DataService:UpdateDataStoreAsync("Storage", 1, false, nil, UpdateData)
:GetFromDictionary()
Function of: GetDataService
Description:
Returns the value of the given Dictionary and key from the sub Dictionary.
Parameters
Name | Type | Default | Description |
---|---|---|---|
Dictionary | Table | The table that needs searching | |
Key | String | The key identifying the entry being retrieved from the dictionary |
Returns
Return Type | Summary |
---|---|
Variant | The table/Value from the specified key. This is nil if nothing is found. |
Code Samples
Retrieving value
This code demonstrates how the function is used in a simple way.
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local DataService = Base:GetDataService()
local fooTable2 = {
z = {q = 5};
t = {
u = 3
}
}
print(DataService:GetFromDictionary(fooTable2, "u"))
-- output: 3
Delegate
:GetDelegateService()
Function of: Module.Init
Description:
This function returns the full module from on the framework regarding all the functions that can be used. Without any effort you can create delegates and fire functions simultaneously or directly after each other.
Returns
Return Type | Summary |
---|---|
Table | All the functions regarding this service |
.Create()
Function of: GetDelegateService
Description:
Creates the table that stores all the functions and contains all the functions to handle the table.
Parameters
Name | Type | Default | Description |
---|---|---|---|
Wrap | Bool | If set to true the functions inserted into this delegate will run at the same time |
Returns
Return Type | Summary |
---|---|
Table | All the functions that are used to handle the delegate function stack. |
:Add()
Function of: GetDelegateService.Create
Description:
Adds a function to the delegate.
Parameters
Name | Type | Default | Description |
---|---|---|---|
Function | Function | Any non returning functions |
Code Samples
Adding a function to the Delegate
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local delegateService = Base:GetDelegateService()
local Delegate = delegateService.Create(false)
function FunctionToAdd()
Workspace.Brick.CFrame = CFrame.new(0,0,0)
end
Delegate:add(FunctionToAdd)
:Remove()
Function of: GetDelegateService.Create
Description:
removes a function from the delegate.
Parameters
Name | Type | Default | Description |
---|---|---|---|
Function | Function | Any non returning functions |
Code Samples
Adding and removing a function to the Delegate
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local delegateService = Base:GetDelegateService()
local Delegate = delegateService.Create(false)
function FunctionToAdd()
Workspace.Brick.CFrame = CFrame.new(0,0,0)
end
Delegate:add(FunctionToAdd)
Delegate:remove(FunctionToAdd) --// no longer exists in the delegate
:Invoke()
Function of: GetDelegateService.Create
Description:
invokes all functions attached to the created delegate.
Code Samples
Invoking several existing functions within the specified delegate.
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local delegateService = Base:GetDelegateService()
local Delegate = delegateService.Create(true)
function FunctionToAdd()
wait(1)
Workspace.Brick.CFrame = CFrame.new(0,0,0)
end
function Function2Add()
Workspace.Brick.CFrame = CFrame.new(0,1,0)
end
Delegate:Add(FunctionToAdd)
Delegate:Add(Function2Add)
Delegate:Invoke()
--// sets the brick first to 0,1,0 then to 0,0,0 due to wrap=true
--// this is useful for when you need functions to run at the same time or if
--// wrap is disabled making it run one function after another.
:GetInvocationList()
Function of: GetDelegateService.Create
Description:
Returns the invocation list of the delegate
Returns
Return Type | Summary |
---|---|
Table | Contains all functions that previously got added to the delegate |
HTTP
:GetHttpService()
Function of: Module.init
Description:
This function returns the full module from on the framework regarding all the functions that can be used. Using httpService is now easier using this.
Returns
Return Type | Summary |
---|---|
Table | All the functions regarding this service |
:GetResponseAsync()
Function of: GetHttpService
Description:
send a Get request to the specified link
Parameters
Name | Type | Default | Description |
---|---|---|---|
Link | String | The link which the get request gets sent to | |
noCache | Bool | False | |
JsonDecode | bool | False | |
Headers | Table |
Returns
Return Type | Summary |
---|---|
String | Response message from the get request. |
Code Samples
local Mod = require(game.ReplicatedStorage.EasyScriptFramework)
local Base = Mod.Init()
local http = Base:GetHttpService()
local link, noCache, JsonDecode, headers = "https://pastebin.com/raw.php?i=vHLj7NC6", false, false, nil
local data = http:GetResponseAsync(link, noCache, JsonDecode, headers)
print(data)
Searching
:GetSearchService()
Function of: Module.Init
Description:
Returns full access to the functions within this service to either search for specific objects or search within a string.
Returns
Return Type | Summary |
---|---|
Table | All functions regarding the ‘GetSearchService’ method. |
:FindDescendantOfClassAndName()
Function of: GetSearchService
Description:
Returns the Descendant of the given parent, Type and Name
Parameters
Name | Type | Default | Description |
---|---|---|---|
Parent | Object | ||
Name | String | ||
ClassName | String |
Returns
Return Type | Summary |
---|---|
Object |
:FindDescendantWithName()
Function of: GetSearchService
Description:
Returns the Descendant of the given parent and Name
Parameters
Name | Type | Default | Description |
---|---|---|---|
Parent | Object | ||
Name | String |
Returns
Return Type | Summary |
---|---|
Object |
:Match()
Function of: GetSearchService
Description:
Returns true if the full List matches with the String depending the result on the HardCheck and CaseSensitive.
Hardcheck will remove special characters such as [,{;' "
etc.
CaseSensitive will check if the word matches exactly on the case
Parameters
Name | Type | Default | Description |
---|---|---|---|
String | String | ||
HardCheck | Bool | false | |
CaseSensitive | Bool | false | |
List | Table | The Table which the string eventually will match with |
Returns
Return Type | Summary |
---|---|
Bool |
Comparisons
:GetCompareService()
Function of: Module.Init
Description:
Returns the functions regarding the ‘GetcompareService’ method.
Returns
Return Type | Summary |
---|---|
Table | All the functions regarding the ‘GetCompareService’ method. |
:Compare()
Function of: GetCompareService
Description:
Compares an array of if statements regarding if they are correct. making and
keywords in if statements prohibited and time saving. or
can still be used within these comparisons
Parameters
Name | Type | Default | Description |
---|---|---|---|
List | Table |
Returns
Return Type | Summary |
---|---|
Boolean | The full product of all the if statements |
local Mod = require(script.Parent.Main)
local Base = Mod.init()
local CS = Base:GetCompareService() --// Compare Service
if CS:Compare({2 == 2, 3 == 3, (5 == 6 or 6 == 6), 7 == 3, 6 == 1}) then
end
--// would be a replacement for
if 2 == 2 and 3 == 3 and (5 == 6 or 6 == 6) and 7 == 3 and 6 == 1 then
end
Some of these methods/functions may not be in your favor but there’s plenty more to come. The plugin will notify you when there’s an update is available!
Interested?
well then it’s your lucky day! The plugin and framework are available as of today and all the functions should be completely bug free! if you do find bugs let me know! Keep in mind that this framework is meant to make scripting easier and not add anything special to roblox studio (Yet!)