Help with Arrays

Users who are viewing this thread

Hello everyone!
I'm on a quest to learn about arrays and so far I've searched and read just about every post in the entire forum trying to understand how to use these things (arrays).
I've read about slots in the tutorial section (by Caba`drin ) https://forums.taleworlds.com/index.php/topic,142422.0.html
WARP (by Autolykos) https://forums.taleworlds.com/index.php/topic,335511.0.html
and about dynamic arrays (by Sphere). https://forums.taleworlds.com/index.php/topic,127910.msg3083905.html#msg3083905
I've also asked for help in the Q&A where I did receive a reply...
kalarhan said:
Iron Sight said:
I'm trying to learn arrays and while I know what I need to do with them, I can't completely figure them out. I want to create an array that stores items for troops like a virtual inventory and have that inventory apply itself every time the game is loaded. I've read the dynamic arrays post and this is most definitely what I want to use but I can't figure out or find an example of how I would create an item array for troops. Any help would be greatly appreciated. Also, I'm open to examples of how to use other types of arrays, like slots and whatever else there may be. Thanks.

first review this tutorial, in special the SLOT section https://forums.taleworlds.com/index.php/topic,142422.0.html

the system is 0-based. Entities can have a array of data (the slots), like a TROOP. What you can do is use a fake troop (not a actual character or soldier in the game) as a storage, and its slots to save the values you need.

example from VC:
Code:
### These are used as arrays in the scripts. 
  ["temp_array_a","{!}temp_array_a","{!}temp_array_a",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],
  ["temp_array_b","{!}temp_array_b","{!}temp_array_b",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],
  ["temp_array_c","{!}temp_array_c","{!}temp_array_c",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0],

keep in mind that inventory/items are not a singular value. You have item_ID, quantity (when it is a ammo) and IMOD to save, so you will need to work with those 3 values for each item.

I decided to make an actual thread because there seems to be a gap in info between people who are fluent in working with arrays and those of us who aren't. I can't seem to make sense of how to correlate the data in an array to what I want the data to connect to. I don't doubt that I'm over-complicating, misunderstanding or just being completely dense about this  but I thought that if I made a thread then hopefully other people would benefit from this as well.

So, moving on... as a learning project, I want to store a non-hero troops' inventory into an array (like a virtual inventory), clear the troops' actual inventory (I know how to do), save-n-reload game, then copy items from troops' virtual inventory to troops' actual inventory.
How I think it should happen:
I'll have to save the troops' actual inventory into a virtual inventory (as an array?)
I'll need to clear a troops' inventory
The troops' inventory that was cleared will need to have a "trigger" variable (a custom slot?) to indicate that the troops' inventory should be cleared at game_start
Retrieve the items from the array and give the items back to the troop
Reset the trigger that indicates the troops inventory should be cleared at game_start

As stated in my question in the Q&A section, I want to use Sphere's dynamic arrays because I can understand what is going on in each of the scripts and I understand how I can use them to modify the arrays.
What I don't understand is how I'm going to get items info into the arrays. I've looked everywhere for examples that I hoped would "show me the way" but I can't find any.
As replied to my question in the Q&A section, I would have to store at least 3 parts of each items' info (ID, IMOD and quantity) and then have them work together, which makes sense, but how?
I'm assuming that the three temp arrays correspond to the the info that each item needs to be represented?
Also as replied to my question, I can use fake troops as a chest of sorts, which again makes sense, and I'm assuming that I'll have to "mark" every item that goes into the fake troop/chest as belonging to a certain troop (if I decide to change more than 1 troops' inventory)
If/when I learn how to input an items data into an array I will know how I can retrieve that info. This is the only part that's got me caught up. Examples are greatly encouraged. Thanks in advance. Also, if there are notions I'm missing, please let me know.



 
Sphere code tries to bring a common list API, while hiding some of the Warband API tech stuff (like slots). That sort of solution can help, but only if you know what that means. Otherwise you are just increasing the complexity of stuff you need to learn.

want to learn about lists and arrays? Then your best reference is to google for programming tutorials on that subject (it is a basic coding thingy). Learn that (Youtube, text tutorials, etc) and you should be able to understand what all those scripts are doing. Shouldnt take more than 1-2 hours, and you dont need to worry about a language, as this is a theoretical concept that works on any of them.

not want to? Then you should just work with SLOTS directly, as you only need to understand what a basic array does and what operations from Warband API to use.

Warband API doesnt come with array operations, so you need to choose a method to work around that restriction.

Pick one and move from there. Later update this thread when you are ready to implement MBScript code.

1) you know what a array is (concept)
2) you know the operations you will use (or ask)
3) you choosen a method to work with lists or arrays
 
kalarhan said:
Sphere code tries to bring a common list API, while hiding some of the Warband API tech stuff (like slots). That sort of solution can help, but only if you know what that means. Otherwise you are just increasing the complexity of stuff you need to learn.

want to learn about lists and arrays? Then your best reference is to google for programming tutorials on that subject (it is a basic coding thingy). Learn that (Youtube, text tutorials, etc) and you should be able to understand what all those scripts are doing. Shouldnt take more than 1-2 hours, and you dont need to worry about a language, as this is a theoretical concept that works on any of them.

not want to? Then you should just work with SLOTS directly, as you only need to understand what a basic array does and what operations from Warband API to use.

Warband API doesnt come with array operations, so you need to choose a method to work around that restriction.

Pick one and move from there. Later update this thread when you are ready to implement MBScript code.

1) you know what a array is (concept)
2) you know the operations you will use (or ask)
3) you choosen a method to work with lists or arrays

I had researched and understood what arrays were before I asked around and it was a thread that you had replied to that helped me to understand in the first place
https://forums.taleworlds.com/index.php/topic,348485.msg8344857.html#msg8344857
kalarhan said:
objects-tenElementArray.gif


a array is just a bunch of slots. You can then apply controls over it (how to insert elements, search, remove, control size, etc).

You could use, as a example, a troop (call it array_a). Say slots 10-100 are for XXX, 101-200 for YYY, and so on.

For your case: check the modules source for examples on how they use it and do the same. They most likely have scripts for that.
... and this reply by BIGGER Kentucky James
https://forums.taleworlds.com/index.php/topic,337394.msg8007966.html#msg8007966
BIGGER Kentucky James XXL said:
There was a lot of coding jargon in that post -- what keinPlan means is that slots are like global variables attached to things like parties and troops. Using *_set_slot and *_get_slot operations allows you to assign and retrieve these values.

For example, Lord troops have a slot named troop_slot_wealth, which is the amount of money they have. Scripts use "get", "val_add", and "set" this value whenever the lord accumulates or loses money.
... and definitely this one by Kiado, (the whole thread is worth a read for those trying to learn)
https://forums.taleworlds.com/index.php/topic,57051.0.html
Kiado said:
Actually, the way you re-assembled my analogy gives me a better understanding.  Also, whether you teach well or not isn't nearly as important as whether you try and teach at all.  :wink:  It's much appreciated. 

I will drop the mail room analogy, I can see why you say it doesn't work to well.  I think it gave me what I needed though. 

I am going to throw some code up to see if I am following.
Code:
  # script_process_village_raids
  # Input: none
  # Output: none
  # called from triggers every two hours
  ("process_village_raids",
    [
       (try_for_range, ":village_no", villages_begin, villages_end),
         (party_get_slot, ":village_raid_progress", ":village_no", slot_village_raid_progress),
         (try_begin),
           (party_slot_eq, ":village_no", slot_village_state, 0), #village is normal
           (val_sub, ":village_raid_progress", 5),
           (val_max, ":village_raid_progress", 0),
           (party_set_slot, ":village_no", slot_village_raid_progress, ":village_raid_progress"),
         (else_try),

Ok, so in the snippet of the above "process_village_raids" script we have both the "party_get_slot" function and the "party_set_slot" function.  (I am correct in calling them functions right?  As in they represent a hardcoded function in the backend to handle slots?)  Now the game considers a village to be of the "party" type, so I understand why you use the "party_set" and "party_get".  If I used "troop_set_slot" or "troop_get_slot" this is where my robot would fail from your example, correct?

(party_get_slot, ":village_raid_progress", ":village_no", slot_village_raid_progress),

This is saying get the slot for raid progress (slot_village_raid_progress) from the village (":village_no") it is iterating over and make the ":village_raid_progress" variable whatever that slot is equal to.  This gives our script the information from that slot to use in it's internal workings.  Then:

(party_set_slot, ":village_no", slot_village_raid_progress, ":village_raid_progress"),

This is saying set the slot for raid progress(slot_village_raid_progress) for the village (":village_no") to the new value from our script (":village_raid_progress").  This would assign that slot value across all the villages the script iterates through, but each village gets its own slot_village_raid_progress.

If I got that part above right then I guess the rest doesn't really matter technically.  I don't see myself needing or making custom slots at this point, but if I knew how I might better understand the whole process.  Lets say I make a new slot called "slot_village_raid_action", and I don't mean rename it, I mean a whole new slot.  If I did the following two changes to the script from the snippet would it still accomplish the same result?

(party_get_slot, ":village_raid_progress", ":village_no", slot_village_raid_action),
(party_set_slot, ":village_no", slot_village_raid_action, ":village_raid_progress"),

Now, if I am right, the slot name doesn't matter as you said.  All that matters is that it pulls the information from the slot, to return it to the script, since the script technically doesn't give a damn what the name of the slot is, it just goes and looks where you tell it based on its defined constant.  Am I close, or better yet, even right?  I was trying to think simpler. 
... but I honestly didn't know about lists but know I do  :smile:
My issue, which was embarrassingly simple, was that I didn't understand how I was going to get something like "tutorial_spear" turned into a numeric value, to insert into an array as an element, and when I realized it was already dictated in ID_items and is referenced by its item id, I felt stupid and relieved, but moreso relieved because now I can move on.
So now that I've gotten past that embarrassing oversight I'm back in business! And now that I know about lists and arrays I'm going to continue my endeavor using dynamic arrays, but that doesn't mean I don't want to learn more about working with slots directly as you've mentioned.
Are there already scripts that create arrays with slots only, not using fake_troop_temp_arrays? To me it seems very tedious to use only slots directly, especially without any sort of script that tries to organize and manipulate the data within, right?

And while I'm at it, what is the upper limit for slots? This post states a very high number. Is it correct?

Once I get further along in my project and gather as much info as I can about different ways to create arrays I will update my post with code for criticism and hopefully to help someone else out there trying to learn about arrays, in a more laymen fashion. :smile:
 
:oops: sorry, I should have read your OP rather than just scanning it. I’ve only used slots without any more advanced structures. The only problem I’ve had is ensuring that code from different OSPs don’t conflict in attempting to write/hold different data in the same slots that were unused in native Warband/WFaS. Checking module_constants.py can be a pain as the same slots can be used for different purposes. For example, a troop slot only holding data relevant to an ai Lord could also be repurposed for other troops only.
 
the game runs in C++ code, but we do modding using MBScript (over Python), which is a scripting language that access the game engine via a API (operations you find in header_operations.py) and a bunch of flags (see the other header_XXX.py files).

that is why we dont have a library for arrays or lists. Game developers didnt need one on the modding side, they just use it on the engine side.

slots are used as a array type inside the engine. We dont have the functions, we just have the storage, that is why we need to create our own way to handle them.

which is simple. Just use a loop, a few get/set operations, and you are set.

you can use any entity with slots as your storage. Troops is a usual example. The OSP you are using uses DYNAMIC PARTY, which is a entity that can be created and destroyed on runtime, so you dont need to add them on module_parties.py. There are good and bad things associate with that idea. Make sure you are doing proper garbage collection if you use dynamic parties or your savegame will blow up.
-> Download a save game editor and check how the savegame works. You will them see the slots being used and which entities have them like TROOPS, PARTIES, QUESTS, ...

remember that slots start with a numeric value. So choose a default value and be consistent to it. Example: "-1" would be considered a empty slot.

if you need operations to get values from the engine then check Lav's header_operations.py and the proper section. Working with items? Check Z12. You will find operations to get/set values on a item so you can them manipulate them with your arrays.
 
NPC99 said:
:oops: sorry, I should have read your OP rather than just scanning it.
No problem, it happens. My last oversight is way more embarrassing  :oops:

NPC99 said:
...I’ve only used slots without any more advanced structures. The only problem I’ve had is ensuring that code from different OSPs don’t conflict in attempting to write/hold different data in the same slots that were unused in native Warband/WFaS. Checking module_constants.py can be a pain as the same slots can be used for different purposes. For example, a troop slot only holding data relevant to an ai Lord could also be repurposed for other troops only.
I know exactly what you mean and it's definitely been a deterrent when putting together a mod. If there's been heavy use of slots I tend to stay away but then that just limits the features and mechanics in the mod I'm putting together so then I have to decide on which ones I definitely want to incorporate to compile a "base" from.

kalarhan said:
...slots are used as a array type inside the engine. We dont have the functions, we just have the storage, that is why we need to create our own way to handle them.

which is simple. Just use a loop, a few get/set operations, and you are set.

you can use any entity with slots as your storage. Troops is a usual example...
I understand and now having slept on it, I've decided to just work with the troops' slots directly.
So in my project I'm now only concerned with saving the items that are equipped which is a total of 9 slots for each troop, which isn't too many and it's consistent. I'm just gonna save the equipped items as well as a "trigger" in certain slots on the troop whose inventory is getting cleared. Say slot 800 for the trigger and slots 801-809 for the items in the equipment slots that are listed in header_items.

kalarhan said:
The OSP you are using uses DYNAMIC PARTY, which is a entity that can be created and destroyed on runtime, so you dont need to add them on module_parties.py. There are good and bad things associate with that idea. Make sure you are doing proper garbage collection if you use dynamic parties or your savegame will blow up.
-> Download a save game editor and check how the savegame works. You will them see the slots being used and which entities have them like TROOPS, PARTIES, QUESTS, ...
This is why I did opt out of this method, for the time being. I don't know about garbage collection so I will definitely educate myself before starting a fire and not know how to put it out.

kalarhan said:
if you need operations to get values from the engine then check Lav's header_operations.py and the proper section. Working with items? Check Z12. You will find operations to get/set values on a item so you can them manipulate them with your arrays.
I've been using Lav's header_operations for a while now but thanks for the recommendation.
Link to Lav's header_operations http://forums.taleworlds.com/index.php/topic,213060.0.html

Can anyone confirm the upper limit of slots as referenced in my post earlier?
"Maximum number of slots is 1048576."
 
Iron Sight said:
Can anyone confirm the upper limit of slots as referenced in my post earlier?
"Maximum number of slots is 1048576."

The quote’s from cmpxchg8b. Outside of a Taleworlds engine programmer, I can’t think of a more reliable source for that. He created WSE, which hacks into Warband's underlying engine.
https://forums.taleworlds.com/index.php/topic,151194.0.html
 
kalarhan said:
Instead of worrying about weird magic numbers...
Rodrigo Ribaldo said:
Or better yet, concentrate on questions that are relevant to your goal, unless you anticipate a modding trivia quiz in the near future.
Were these statements really necessary? I can't ask questions? Who said I was worried, and who knows better than me what I should concentrate on? My life is in order, this is a hobby and I just like to know things. Come on now. But I do like the "check out this thing" thing.
 
People here are primarily motivated to help other people when they are serious about accomplishing something, and some may be a bit disappointed by random questions.
Please understand that and don't get offended.
 
Rodrigo Ribaldo said:
People here are primarily motivated to help other people when they are serious about accomplishing something, and some may be a bit disappointed by random questions.
Please understand that and don't get offended.
I understand that. That goes without saying really because that applies to just about anything that one person knows and another is learning. At the same time I'm not gonna curtail the "method of my madness" just because some people can't fathom my means. If they wanna answer, then answer, if they don't wanna, then don't. Makes no matter to me. I promise I won't be disappointed if I do or don't understand why they will or won't answer. I'm one of the last persons to be offended by something someone wrote about something I like to do for fun knowing that they know nothing about me. If we all only really knew each other... but since we don't, I'm a very reasonable person who likes to joke around, once I know ya, but one thing I don't do, is assume things about people without proof, nor do I tolerate it. I also like to type a lot late at night while I'm racking my brain over the things I'm tryin to do with this script stuff. lol
 
If you ask how to implement gameplay features, people with more experience will be able to help you find the best method. If you are asking for help with your techniques but not your implementation, all the answers we could ever provide may still not help you get closer to your goal. Reading your posts, I don't really understand your end goal. But here are some important bits of information:
1: absolute biggest one: ID numbers are referenced internally by names with prefixes eg "itm_pike", "trp_looter", etc. These are what we use in the module system to reference IDs, you can use the real ID numeric instead, but then if you change the order of your source file, the ID will change and your code will cease working...
2. Regular troop inventories are not saved the same as hero troop inventories, you will have to enable a line in module.ini for them to save at all.
3. Its almost always easiest to store troop inventories by copying the entire inventory to another troop, instead of defining slots
4. Right now your biggest barrier seems to be not being familiar with operations. Kal mentioned everything above: download lav's header_operations and start reading - skip to the relevant section to learn the item operations or better yet, start by reading the descriptions for each section to get a better overview of how modding itself works.

It's great that you want to learn, but it seems like you're trying to dive right in to something without checking the depth (ha ha.) If you want to learn about arrays specifically or programming in general, there are probably better resources out there. If you tell us what you're actually trying to implement, maybe we can give some more relevant advice.
 
Iron Sight said:
That goes without saying really because that applies to just about anything that one person knows and another is learning

you can do this:

1) setup a test case
2) use a logger to save the results on rgl_log.txt
3) execute inside the game (runtime) and see what happens

things to observe:
1) what happens to the initial slots (say 0 to 10) as you go
2) what happens with the entity slots array size as you use higher positions
3) what happens with the savegame file (think file size)
4) what happens with other entities of the same type
5) what happens when you get around the possible limit (test positions before and after it), remember to also do (1) at the same time

you will have plenty of tech doubts that may lack clear answer, have outdated information (game engine was updated over and over again in the last 15 years), etc. So if you learn how to do the above you will be able to answer those questions in a few minutes (once you get use to the script/trigger coding of MBScript).

remember to enable EDIT MODE when doing tests.
 
Ruthven said:
If you ask how to implement gameplay features, people with more experience will be able to help you find the best method. If you are asking for help with your techniques but not your implementation, all the answers we could ever provide may still not help you get closer to your goal. Reading your posts, I don't really understand your end goal. But here are some important bits of information:
1: absolute biggest one: ID numbers are referenced internally by names with prefixes eg "itm_pike", "trp_looter", etc. These are what we use in the module system to reference IDs, you can use the real ID numeric instead, but then if you change the order of your source file, the ID will change and your code will cease working...
2. Regular troop inventories are not saved the same as hero troop inventories, you will have to enable a line in module.ini for them to save at all.
3. Its almost always easiest to store troop inventories by copying the entire inventory to another troop, instead of defining slots
4. Right now your biggest barrier seems to be not being familiar with operations. Kal mentioned everything above: download lav's header_operations and start reading - skip to the relevant section to learn the item operations or better yet, start by reading the descriptions for each section to get a better overview of how modding itself works.

It's great that you want to learn, but it seems like you're trying to dive right in to something without checking the depth (ha ha.) If you want to learn about arrays specifically or programming in general, there are probably better resources out there. If you tell us what you're actually trying to implement, maybe we can give some more relevant advice.
The end goal is literally spelled out, IDK what else to say, just a project to help me understand how to use arrays with the items in a troops' inventory.
1. I understand about the ID#'s but for some reason when first learning arrays, I completely missed them. Was a duh moment for sure. This revelation should have been indicated as rectifying one issue in an earlier post of mine, if it didn't then sorry but as of now, "I'm back in business." Meaning I've progress with my endeavor.
2. I found this out after progressing but I didn't know about "a line in module.ini for them to save at all". Thanks!
3.This I also found out once progressing but it's a work around for what I'm specifically trying to do to learn and defeats its purpose.
4.This is definitely not my biggest barrier. I've been using Lav's header_operations for a long while now and have been scripting for a while but just never intentionally used arrays. I don't know how or what context brought this about, but ok.

"it seems like you're trying to dive right in to something without checking the depth", who doesn't do this? I've been a mech head in the military for a while now and once I know a particular vehicle or appliance or whatever's theory of operation, I'm good to go. I can figure out how to repair, overhaul and improve, which I've done to just about every land vehicle in our arsenal, including appliance-like vehicles lol. I might've known some of what I know now if I didn't dive right in but I know I wouldn't have known everything I know now since I did.

kalarhan said:
Iron Sight said:
That goes without saying really because that applies to just about anything that one person knows and another is learning

you can do this:

1) setup a test case
2) use a logger to save the results on rgl_log.txt
3) execute inside the game (runtime) and see what happens

things to observe:
1) what happens to the initial slots (say 0 to 10) as you go
2) what happens with the entity slots array size as you use higher positions
3) what happens with the savegame file (think file size)
4) what happens with other entities of the same type
5) what happens when you get around the possible limit (test positions before and after it), remember to also do (1) at the same time

you will have plenty of tech doubts that may lack clear answer, have outdated information (game engine was updated over and over again in the last 15 years), etc. So if you learn how to do the above you will be able to answer those questions in a few minutes (once you get use to the script/trigger coding of MBScript).

remember to enable EDIT MODE when doing tests.
Thanks! Wilco!

Since the absence of information seems to breed misunderstanding... I'm almost done with my project, well, until I found out about "a line in module.ini" so now I'll have to check in on that but still, just about done. Thanks for yalls input!

*Edit: Ok, so I enabled the game to save troops inventory... why isn't this done by default?(rhetorical) Are there bugs associated with it's use? (unrhetorical)
 
Iron Sight said:
*Edit: Ok, so I enabled the game to save troops inventory... why isn't this done by default?(rhetorical) Are there bugs associated with it's use? (unrhetorical)

Warband Native doesnt have a feature where you can edit soldiers inventory, so it was never necessary to update their inventory. That feature was reserved to "hero type" like companions and lords. Developers were focused on creating a game (Native), so you wont find stuff in the engine API or modsys that is not useful for them (save some exceptions created by community requests). Just look at WSE, which is a tool to make a lot of new operations available on the modder side created by modders. And so on.

Maybe MBF&S or so (dont recall) added this as a game feature and thus the engine got a new functionality. Not used for Native, but available for mods.

Similar on how VC added many new flags and operations to the engine that are not and will never be used on Native. They are there if you want to use them tho.
 
Iron Sight said:
Ruthven said:
If you ask how to implement gameplay features, people with more experience will be able to help you find the best method. If you are asking for help with your techniques but not your implementation, all the answers we could ever provide may still not help you get closer to your goal. Reading your posts, I don't really understand your end goal. But here are some important bits of information:
1: absolute biggest one: ID numbers are referenced internally by names with prefixes eg "itm_pike", "trp_looter", etc. These are what we use in the module system to reference IDs, you can use the real ID numeric instead, but then if you change the order of your source file, the ID will change and your code will cease working...
2. Regular troop inventories are not saved the same as hero troop inventories, you will have to enable a line in module.ini for them to save at all.
3. Its almost always easiest to store troop inventories by copying the entire inventory to another troop, instead of defining slots
4. Right now your biggest barrier seems to be not being familiar with operations. Kal mentioned everything above: download lav's header_operations and start reading - skip to the relevant section to learn the item operations or better yet, start by reading the descriptions for each section to get a better overview of how modding itself works.

It's great that you want to learn, but it seems like you're trying to dive right in to something without checking the depth (ha ha.) If you want to learn about arrays specifically or programming in general, there are probably better resources out there. If you tell us what you're actually trying to implement, maybe we can give some more relevant advice.
The end goal is literally spelled out, IDK what else to say, just a project to help me understand how to use arrays with the items in a troops' inventory.
1. I understand about the ID#'s but for some reason when first learning arrays, I completely missed them. Was a duh moment for sure. This revelation should have been indicated as rectifying one issue in an earlier post of mine, if it didn't then sorry but as of now, "I'm back in business." Meaning I've progress with my endeavor.
2. I found this out after progressing but I didn't know about "a line in module.ini for them to save at all". Thanks!
3.This I also found out once progressing but it's a work around for what I'm specifically trying to do to learn and defeats its purpose.
4.This is definitely not my biggest barrier. I've been using Lav's header_operations for a long while now and have been scripting for a while but just never intentionally used arrays. I don't know how or what context brought this about, but ok.
Sorry if my post was unclear. It was late at night... I am trying to help.

If you are doing this only to learn about using arrays in warband, there might be easier tests you could do where you won't run into unexpected complications - such as the saved regular troop inventories etc that would present very unintuitive problems. You also keep saying things like "almost done my project" which makes me think you are using this for something in particular. Like I said, it was late...

1: I was confused by this:
Iron Sight said:
My issue, which was embarrassingly simple, was that I didn't understand how I was going to get something like "tutorial_spear" turned into a numeric value, to insert into an array as an element, and when I realized it was already dictated in ID_items and is referenced by its item id, I felt stupid and relieved, but moreso relieved because now I can move on.
I thought you were getting the numeric ID manually from ID_items.  :razz:  My mistake.

3. "This I also found out once progressing but it's a work around for what I'm specifically trying to do to learn and defeats its purpose."
I guess so, but if you only learn how to do something which is unnecessary, what are you really learning? Not having seen any of your code, it's hard to say if you're on the right track or not. You could complete your stated project with good code or bad code and it would work either way - but only one way is going to be useful in the future.

Iron Sight said:
4.This is definitely not my biggest barrier. I've been using Lav's header_operations for a long while now and have been scripting for a while but just never intentionally used arrays. I don't know how or what context brought this about, but ok.
The context for this:
Iron Sight said:
As replied to my question in the Q&A section, I would have to store at least 3 parts of each items' info (ID, IMOD and quantity) and then have them work together, which makes sense, but how?
It seemed like you maybe weren't aware of the operations to get info/set slots. I admit I really didn't give you the benefit of the doubt here. My misinterpretation about the IDs above made me assume the worst.  :lol:

I'm sorry for the misunderstandings - but if you don't post any code, it's hard to know where your actual level of knowledge is at. You're here because you are (or were) lacking some info, we all have gaps in our knowledge and there's nothing wrong with that.
 
Ruthven said:
If you are doing this only to learn about using arrays in warband, there might be easier tests you could do where you won't run into unexpected complications
You are 100% correct, I could/should have chosen a simpler test but honestly once I realized how difficult it would be to use 3 types of info together in an array, with what I knew then, my interest was piqued and it was, "game on!", lol.

Ruthven said:
I'm sorry for the misunderstandings - but if you don't post any code, it's hard to know where your actual level of knowledge is at. You're here because you are (or were) lacking some info, we all have gaps in our knowledge and there's nothing wrong with that.
No worries, misunderstandings happen, I understand that, lol. And I by no means am hostile in my replies. (just in case any of them were perceived as such)
I intentionally don't post code unless I absolutely just can't figure out which operations are needed, or what order, or any other plethora of issues that arise when someone just gets "stumped". (ya won't get yur fix from me, ya bunch of code junkies! lol)
I'm indifferent to whether anyone knows what "level" my knowledge is at but I do understand how teachers can use that info to better get through to students. But trust me, whatever you are trying to teach, will get through to me, one way or the other on my part.
I'm most definitely here because I was lacking info, and specifically in this case wasn't really lacking the info but just failed to realize it, lol. If I'd have realized it the day before, I'd never have made this post and even if you'd have been the first person to reply, I'd have been done sooner. I'm definitely not afraid to ask about something I don't know.
Also, I seen your "Explorer" mod. Amazing! (to say the least)
And now on to learn about garbage collection!
 
Back
Top Bottom