Hi
I have 3 questions.
1. How do I loop through and read inventory data in Javascript?
Something like..
for(var i in player.inventory) {
var name = player.inventory.info.shortname
}
2. How do I open and read a file (namely a configuration file from another mod) in Javascript?
I see an example of how to do this in LUA and C#, but not Javascript. http://oxidemod.org/threads/edit-default-config-of-plugin-a-using-plugin-b.6884/
3. Is there any way I can inspect the javascript API in such a way that I don't have to ask dumb questions like these?
Any help is appreciated. Expect some (javascript) mods from me soon!
[DOUBLEPOST=1427670320,1427536681][/DOUBLEPOST]I have solved 2 of my questions.
Question 1
var inventory = player.inventory.AllItems();
for(var i in inventory) {
var item = inventory;
var name = item.info.displayName.english;
var amount = item.amount;
var condition = item.condition;
var blueprint = item.isBlueprint;
var rarity = item.info.rarity;
var stackable = item.info.stackable;
var type = item.info.shortname;
var category = item.info.category;
}
Question 3
I opened the OXIDE master in Visual Studio Express and used Object Explorer to retrieve the information I needed.
JavaScript player inventory & open file
Discussion in 'Rust Development' started by Your Old Best Friend, Mar 30, 2015.