Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Nov 2017
E
Erikem Offline OP
journeyman
OP Offline
journeyman
E
Joined: Nov 2017
Hi,

Please add some form of StringSplit to Story scripting because it is needed often when working with various custom statuses that are combined of name and some form of counter (like "Stance_01")

Possible implementation #1 (with 2 OUT parameters):
StringSplit
[in](STRING)_String,
[in](STRING)_Separator,
[in](INTEGER)_Direction,
[out](STRING)_ResultLeft
[out](STRING)_ResultRight

Where
_String - input string (for example "My_-_Custom_-_Status_-_01")
_Separator - a string we are searching for and that is used to separate _String into 2 parts (for example "_-_")
_Direction - denotes search direction for separator as either "from left to right" or "from right to left". Can be 0 (l->r) and 1 (r->l)

Examples of usage:
StringSplit("My_-_Custom_-_Status_-_01","_-_",0) = "My", "Custom_-_Status_-_01"
StringSplit("My_-_Custom_-_Status_-_01","_-_",1) = "My_-_Custom_-_Status", "01"



Possible implementation #2 (in case having 2 OUT parameters is hard to implement):
StringSplit
[in](STRING)_String,
[in](STRING)_Separator,
[in](INTEGER)_Direction,
[in](INTEGER)_Side,
[out](STRING)_Result

Where
_String - input string (for example "My_-_Custom_-_Status_-_01")
_Separator - a string we are searching for and that is used to separate _String into 2 parts (for example "_-_")
_Direction - denotes search direction for separator as either "from left to right" or "from right to left". Can be 0 (l->r) and 1 (r->l)
_Side - denotes a side of split that is returned - either left or right. Can be 0 (left) and 1 (right)

Examples of usage:
StringSplit("My_-_Custom_-_Status_-_01","_-_",0,0) = "My"
StringSplit("My_-_Custom_-_Status_-_01","_-_",1,0) = "My_-_Custom_-_Status"
StringSplit("My_-_Custom_-_Status_-_01","_-_",0,1) = "Custom_-_Status_-_01"
StringSplit("My_-_Custom_-_Status_-_01","_-_",1,1) = "01"


In both implementation a FALSE should be returned if _Separator is not found

Joined: Sep 2017
Location: Belgium, Ghent
addict
Offline
addict
Joined: Sep 2017
Location: Belgium, Ghent
Hey Erikem,

thanks for the suggestion! We'll note it down wink

Sincerely,
Kevin


CTRL+K the elf

Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5