Assign new strings into a previous string

Users who are viewing this thread

Kosolov325

Recruit
It's possible to add new values inside a string?
I'm trying to loop through an instance which has 48 slots... and i wanna assign their item_ids on a string with this "|" between the ids
i did like that.. but isn't working
str_ibank_message = "{reg24}|"

Python:
(str_store_string, s3, "str_ibank_message"),
(try_for_range, ":inventory_slot", slot_scene_prop_inventory_begin, ":inventory_end"),
  (scene_prop_get_slot, ":item_id", ":instance_id", ":inventory_slot"),
  (try_begin),
    (neq, ":inventory_slot", ":inventory_end"), #On the last slot does not add another {reg24}|
    (assign, reg24, ":item_id"),
    (str_store_string_reg, s3, reg24),
    (str_store_string, s3, "str_ibank_message"),
  (else_try),
    (assign, reg24, ":item_id"), #On the last slot does not add another {reg24}|
    (str_store_string_reg, s3, reg24),
  (try_end),
 
Last edited:
Solution
Those strings are used as format strings rather than actual strings. You cannot change their content.
You can use a long format string like this. :smile:
"{reg0}|{reg1}|{reg2}|{reg3}.................{reg47}"
or you can use WSE2 it has some operations that may help you. It also allows you to split strings if you want to revert the process.
str_split = 4213 #(str_split, <destination>, <string_register>, <string_1>, <delimiter>, [<skip_empty>], [<max>]), #Splits <string_1> using <delimiter> into a range of string registers, starting from <string_register>, storing [<max>] substrings at most (default = unlimited), ignoring empty (zero length) substrings if [<skip_empty>] (default = false)...
Those strings are used as format strings rather than actual strings. You cannot change their content.
You can use a long format string like this. :smile:
"{reg0}|{reg1}|{reg2}|{reg3}.................{reg47}"
or you can use WSE2 it has some operations that may help you. It also allows you to split strings if you want to revert the process.
str_split = 4213 #(str_split, <destination>, <string_register>, <string_1>, <delimiter>, [<skip_empty>], [<max>]), #Splits <string_1> using <delimiter> into a range of string registers, starting from <string_register>, storing [<max>] substrings at most (default = unlimited), ignoring empty (zero length) substrings if [<skip_empty>] (default = false). Stores the amount of substrings split into <destination>
Couldn't find anything for easy string concatenation in it though.
 
Upvote 0
Solution
Back
Top Bottom