Basic Lua Knowledge
Re: Basic Lua Knowledge
Another question XD
There is a mode to extract also wherehouse inventory, pet inventory?
There is a mode to extract also wherehouse inventory, pet inventory?
-
- VIP
- Posts: 159
- Joined: Tue Jan 10, 2017 6:39 pm
- Has thanked: 34 times
- Been thanked: 112 times
Re: Basic Lua Knowledge
Hard question for me... I guess if dll has their offsets, it may show them.. but not current yet
Re: Basic Lua Knowledge
It's ok, thanks for your help, i'm not too expert with lua language, i know a bit better c#
XD


- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Basic Lua Knowledge
I have programmed in many scripts in other games, like even in L2Walker and the powerful ZRanger (used in L@ again).
I kinda find AS scripting very hard to understand or follow, it is like it has less structure than other scripts. I also specialized in C and C++ in the university, so I am pretty familiar with it and my final project was simulation (which is one of the tough things to do in programming, like AI)
I can understand most existing scripts (understand their functionality and what do I need to change to make a different thing) and I have done a few myself, but I just find it very abstract, like the example below:
Code: Select all
function OnLoad()
for Item in ListIterator( InventoryList:GetList() ) do
Write(""..Item:GetName().." "..Item:GetAmount())
end
end
Code: Select all
for (i=0;i<10;i++)
{
if(inventory[i]=="Potion")
{ use this or that
}
}
I do not find these here, and there are other things like the double dots "..item:getname()" and what does "Item" stand for, is it a variable set by AS itself, do we have a pointer (like my example, "i"). I kinda find this pretty hard to follow, even for a IT graduate like me.
Last edited by Diavolakos on Thu Jun 15, 2017 11:56 am, edited 1 time in total.
I play on NA Server Siel
-
Onlinenucular
- Site Admin
- Posts: 260
- Joined: Sat Jan 07, 2017 9:08 pm
- Has thanked: 27 times
- Been thanked: 388 times
Re: Basic Lua Knowledge
Look inside the main folder of AionScript for a file named AionScript.pdf
Item is instanced object of the Model Inventory.
For possible functions of the model look inside AionScript.pdf
If you are a graduated programmer read the manual dude really....
It tells you exactly InventoryList:GetList() returns an List of inventory objects.
You will find all things in there.
For your other question look inside Aionscript.lua what the function GetList actually does.
Item is instanced object of the Model Inventory.
For possible functions of the model look inside AionScript.pdf
If you are a graduated programmer read the manual dude really....
It tells you exactly InventoryList:GetList() returns an List of inventory objects.
You will find all things in there.
For your other question look inside Aionscript.lua what the function GetList actually does.
- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Basic Lua Knowledge
Yes I read the pdf but it simply has the names of functions and the names of preset variables. It doesn't say exactly how they are used.
I am a computer programmer but I do not know all languages, I specialized in C/C++
But you said that
I am a computer programmer but I do not know all languages, I specialized in C/C++
But you said that
returns into where, and how do I find the object I need, don't I need this to be some sort of an array that has all 90 slots so I can look into a specific inventory[ i ] slot where "i" is a pointer I use to change the cell?InventoryList:GetList() returns an List of inventory objects
Last edited by Diavolakos on Thu Jun 15, 2017 11:56 am, edited 1 time in total.
I play on NA Server Siel
-
Onlinenucular
- Site Admin
- Posts: 260
- Joined: Sat Jan 07, 2017 9:08 pm
- Has thanked: 27 times
- Been thanked: 388 times
Re: Basic Lua Knowledge
Nope, the C equivalent are linked lists, so you can't access it directly by defining the an key.
https://en.wikipedia.org/wiki/Linked_list
https://en.wikipedia.org/wiki/Doubly_linked_list
would also work
or
You always have to iterate over all entries and you do exactly the same here.
https://en.wikipedia.org/wiki/Linked_list
https://en.wikipedia.org/wiki/Doubly_linked_list
Code: Select all
for Item in ListIterator( InventoryList:GetList() ) do ....
Code: Select all
InvList = InventoryList:GetList();
for Item in ListIterator( InvList ) do ....
Code: Select all
InvList = InventoryList:GetList();
MyInventory = ListIterator( InvList );
for SingleItem in MyInventory do ....
Just see how linked lists work.returns into where, and how do I find the object I need, don't I need this to be some sort of an array that has all 90 slots so I can look into a specific inventory slot where "i" is a pointer I use to change the cell?
You always have to iterate over all entries and you do exactly the same here.
- Diavolakos
- Posts: 114
- Joined: Thu Apr 20, 2017 5:05 am
- Has thanked: 31 times
- Been thanked: 13 times
Re: Basic Lua Knowledge
Oh yes I am well aware of linked lists, floating in non serial way so you have to go through each cell from start so as to find the next one. Thanks for the input.nucular wrote: ↑Tue Jun 13, 2017 3:41 pmNope, the C equivalent are linked lists, so you can't access it directly by defining the an key.
https://en.wikipedia.org/wiki/Linked_list
https://en.wikipedia.org/wiki/Doubly_linked_list
would also workCode: Select all
for Item in ListIterator( InventoryList:GetList() ) do ....
orCode: Select all
InvList = InventoryList:GetList(); for Item in ListIterator( InvList ) do ....
Code: Select all
InvList = InventoryList:GetList(); MyInventory = ListIterator( InvList ); for SingleItem in MyInventory do ....
Just see how linked lists work.returns into where, and how do I find the object I need, don't I need this to be some sort of an array that has all 90 slots so I can look into a specific inventory slot where "i" is a pointer I use to change the cell?
You always have to iterate over all entries and you do exactly the same here.
I know I will never be good in lua since I kinda find it a little less structured than C/C++ that I am so used. But this clears things up.
I play on NA Server Siel
Who is online
Users browsing this forum: No registered users and 1 guest