You store all of your data in one long string and then use substring? That may be something I could implement. Would you give me a little example of how I can save something into a string that already exists? This is something I have never done, so details would be great!
Convert all of the data you want to save into separate strings. Then concatenate those strings into one long string. Then encrypt and bank the long string. When loading, decrypt the long string, then use the Word of String or Substring functions to split the long string into smaller strings again. For example:
These strings indicate 1) the unit, 2) the difficulty, and 3) a binary integer to determine whether the combination was completed or not. In other words, this player beat both easy and medium difficulties with a marine, but not hard.
Next, use the Set Variable action and the Combine Strings Multiple function to concatenate, separating with a space:
Encrypt, bank, decrypt, load, and you should have the same string.
Now set String 1 = Word 1 of String 4; String 2 = Word 2 of String 4; String 3 = Word 3 of String 4
As I said, this makes things easy for me but it may or may not work for you. At this point, you would simply need to check if each string contains the number 1 to find out if that particular combination has been completed, then act accordingly.
True. What I am trying to do is find out if the player has completed each difficulty level (there are 6) with a certain unit, let's say Marine. The bank are loaded and the encryption/decryption works fine as the values in the first example directly translate to the variables in the second example. The only thing is, is that the loop doesn't seem to realize when the statement is true, which is odd, because when I type it out (first example) it works fine.
I was just trying to find out if there is an error in my loop that I am not seeing. The loop (should) works like this:
Loop through the difficulty levels and through the types of units (all have been assigned numbers for ease of tracking). So it runs like this: Unit 1 - Difficulty 1 - true/false. Unit 1 - Difficulty 2 - true/false etc...
In the first example, znevar is Marine and the letter in front of that is for the difficulty level that I combine together with Combine String. The values are like that in the bank file, but the loop somehow doesn't go into the true part.
If you could just look at the loop and see if there are any errors that I am not seeing, that would be great. :)
Faust
Okay, I think I understand now. There are two possibilities that I can think of.
The first is that the condition function "(Bank Player_Bank[(Picked player)] has Bank Terran Unit Encryption Difficulty and Unit[i][n] in section "cynlre") == True" is not checking what you think it's checking. If these two elements are combined into a single string within the bank, then this function might be checking for two separate elements, and since they are always combined it will always return false. It might help to extract all of these elements into a single string and use the "String Contains Substring" function. I usually save all relevant data into a single string anyway when banking because it keeps the banks simple, though this may not work for you.
The other possibility is that your function is exceeding Starcraft 2's limits. The fact that you are stacking 3 loops on top of each other might simply be too much for Starcraft 2 to handle, so the only solution might be to use less efficient code.
I'm not really sure what you're trying to do so it's hard to pinpoint the problem. You may have simply forgot to load the player's bank before checking it. Or it may need to be decrypted if you are using any kind of encryption.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
@Faust7777: Go
Convert all of the data you want to save into separate strings. Then concatenate those strings into one long string. Then encrypt and bank the long string. When loading, decrypt the long string, then use the Word of String or Substring functions to split the long string into smaller strings again. For example:
String 1: marine_easy_1
String 2: marine_medium_1
String 3: marine_hard_0
These strings indicate 1) the unit, 2) the difficulty, and 3) a binary integer to determine whether the combination was completed or not. In other words, this player beat both easy and medium difficulties with a marine, but not hard.
Next, use the Set Variable action and the Combine Strings Multiple function to concatenate, separating with a space:
String 4: marine_easy_1 marine_medium_1 marine_hard_0
Encrypt, bank, decrypt, load, and you should have the same string.
Now set String 1 = Word 1 of String 4; String 2 = Word 2 of String 4; String 3 = Word 3 of String 4
As I said, this makes things easy for me but it may or may not work for you. At this point, you would simply need to check if each string contains the number 1 to find out if that particular combination has been completed, then act accordingly.
Okay, I think I understand now. There are two possibilities that I can think of.
The first is that the condition function "(Bank Player_Bank[(Picked player)] has Bank Terran Unit Encryption Difficulty and Unit[i][n] in section "cynlre") == True" is not checking what you think it's checking. If these two elements are combined into a single string within the bank, then this function might be checking for two separate elements, and since they are always combined it will always return false. It might help to extract all of these elements into a single string and use the "String Contains Substring" function. I usually save all relevant data into a single string anyway when banking because it keeps the banks simple, though this may not work for you.
The other possibility is that your function is exceeding Starcraft 2's limits. The fact that you are stacking 3 loops on top of each other might simply be too much for Starcraft 2 to handle, so the only solution might be to use less efficient code.
I'm not really sure what you're trying to do so it's hard to pinpoint the problem. You may have simply forgot to load the player's bank before checking it. Or it may need to be decrypted if you are using any kind of encryption.