Trigger actions to split String-values

Give us your feedback about the Level Editor! Or have an idea? Post it here!

Trigger actions to split String-values

Postby Nyove » 7 October 2020, 07:19

Hey everyone,

With the recent new trigger action, it gave Gameplay Modifications more purpose than before.

However, we lack a proper way of splitting a string-value in a variable, which may be important in cases like this, where you may want to input a list of String (perhaps something like god-lowGravity-noPSI-grass-night.)
Note: I know you can test if a specific string-value given a String variable for the above example. However, this is just an scenario and is not applicable in a general where you cannot predict the input.

Here are the two trigger actions I proposed.
---
Set string value of variable 'A' to a part of string-value of variable 'A' ending with character 'B'
Example: After passing the variable containing String value 'noob-pro' to parameter A, and passing the value '-' to parameter B, the resulting string-value of variable should be 'noob'

Remove string-value from variable 'A' with string-value of variable 'B'
Example: After passing the variable containing String value 'noob-pro' to parameter A, and passing the variable containing String value 'noob' to parameter B, the resulting string-value of variable should be '-pro'.
(From there you can remove the seperator character '-')

In the situation where variable B contains character that variable A does not have, there could be two possible scenarios.
1. Throw an exception (error code) and stop the rest of the trigger execution.
2. Ignore the additional character and carry on with string deduction.
---
I believe these two trigger actions are addition to the ALE not only because it achieve the ability to split a string and store them into a list of variables [accomplishing a niche specific task], they also have their own generic purposes.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: Trigger actions to split String-values

Postby YensLe » 7 October 2020, 07:40

Yeah, this is definitely what it needs since I already experimented with the new trigger action on my multiplayer maps and I gotta say it was amazing!

Though there was a problem is that the trigger actions only accepts one string such as fast motion or any other but won't accept strings like fast motion combined with double damage for example which is quite disappointing so yeah I agree that there should be a way to make it so that we can put in more codes then just one cause what if a player wants it to be fast motion and double health or anything else for example?

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: Trigger actions to split String-values

Postby YensLe » 7 October 2020, 07:49

I've been wondering.

Why not have gameplay modifications for single player mode as well come to think of it?

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: Trigger actions to split String-values

Postby Nyove » 7 October 2020, 08:22

Hey YensLe,

In your case specifically, if the parameters you set are constant, you can actually detect multiple parameters at once.

The map source for your reference will be: https://www.plazmaburst2.com/level_edit ... emodify&a=
Note: Make a copy of the map source, as I will delete the map soon.

Let's say your map wants to check if these strings exist.
Fast-motion
Slow-motion
Low-Gravity
High-Gravity
No-PSI

Try creating a match on MP, and type any of the 5 words in the gameplay modification field in any order. (does not matter if you use comma, dot, dash, space, or anything really.)

We utilise this very trigger action
- Set value of the variable 'A' to 1 if string-value of variable 'A' contains string-value 'B' and to 0 in else case

We just need to test if the variable contains the string mentioned, by testing if the variable contains 1 after the test.
Note: Be sure to make a copy of the variable before testing, as testing the variable will overwrite it with either 1 or 0.

In the situation where there is a conflict request, like Fast-motion and Slow-motion, you can either just overwrite one request or implement addition trigger action to test if both strings exist in the variable and prompt error message.

The above trigger contraption works when you know what strings to specifically detect, however for generic cases where we do not know what string to detect, we still need trigger actions to perform splitting of string values.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: Trigger actions to split String-values

Postby YensLe » 7 October 2020, 09:29

Hmmm, thanks for the feedback.

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: Trigger actions to split String-values

Postby yi en » 7 October 2020, 13:06

a further template of map tools are here:
https://www.plazmaburst2.com/?s=9&a=&m= ... &id=998833
User avatar
yi en
Civil Security Boss [500]
 
Posts: 556
Joined: 20 August 2013, 09:10
Location: What do you need, then?


Return to Level Editor

Who is online

Users browsing this forum: Bing [Bot]