Hello guys i came here to show to yours how you can create your custom data base,changing and getting the values.
I'm starting here knowing that everyone knows what is a data base.
Ok Let's go.
In this example we will put the name of your character in the data base.
1º First Step: Creating the Data Base.
init start
MyData = opendatabase('Sajean')
init end
MyData: Variable, you can put what you want here.
opendatabase('Sajean'): Here you are creating your database, you can put any name that you want.
Now we data base is created.
2º Second Step: Setting values for Data base.
init start
MyData = opendatabase('Sajean')
MyData:setvalue('Sajean','Name',$name)
init end
setvalue: Here we are setting the value to we data base.
'Sajean': Is the name of the SectionName.
'Name': You can set what you want here, DataName.
$name: Your character name.
This code will add into the data base SectionName 'Sajean' in the 'Name' DataName your chracter '$name'.
Now we data base have your name stored in 'Name' DataName.
3º Third Step: Getting values stored in Data base.
init start
MyData = opendatabase('Sajean')
MyData:setvalue('Sajean','Name',$name)
init end
auto(1000)
local yourName = MyData:getvalue('Sajean','Name')
print(yourName)
local yourName: This creating an local variable, you can put what you want.
getvalue: Here we are getting the value stored in your Data base.
This code will get into the data base SectionName 'Sajean' in the 'Name' DataName, will print(yourName) in the console.
Your CustomDataBase is stored in windbot folder.
windbot/data/custom.
NOTE: For you see what i'm saying you need to download an SQLite and you will can acess your data an seeing the value.
Here is an example of how your data is.
Now we data was created and your name is stored in the data.
Here i will give simple example of functions to you get and add values to your data, if you are working with numbers or count.
init start
function getValue()
return MyData:getvalue('Sajean','Count') --This function will get the value of the count.
end
function addValue(...)
return MyData:setvalue('Sajean','Count',getValue()+...) --This function will add value to your count.
end
function decreaseValue(...)
return MyData:setvalue('Sajean','Count',getValue()-...) --This function will decrease value to your count.
end
init end
Thank you.