Jump to content
Aveyond Studios Community
Duffer123

If (String Contains) HeroAction

Recommended Posts

@Ant,

Here goes nothing.  My first attempt at a Custom Action.  I've just (I hope) attached the relevant folders and two c# files.

I'm not sure what to do with the comparison variable.

Basically designed to return a bool true if value1 string contains value2 string.

Can you review and let me have some feedback?  If possible, heavily comment my code...?

thanks...

 

p.s. - I'd add a Tag for posts relating to 'Custom Action'.... ;)

[edit - 6-10-17]     version 1.1

I have attached a revised Unity Package including the new custom Hero Action "If (String Contains)" but taking in to account Ant's amendments...

[edit - 7-10-17]     version 1.2

I have attached a revised Unity Package including the new custom HeroAction "If (String Contains)" taking into account Ant's amendments but also attempting to introduce a bool field where if set to true the search is case insensitive and if set to false the  search is case sensitive.

 

HeroKit Action - If (String Contains) - v1.2.unitypackage

Share this post


Link to post
Share on other sites

Works like a charm. I had to make two changes though:

In IfChangeStringFields.cs, I changed 4 to 5 on line 24:

  • ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 5);

Unity Package didn't come with the Hero Action file. I created one and connected it to the CS files.

Share this post


Link to post
Share on other sites

Not stupid at all. The action should only require the 4, but for some reason, it needs at least a 5. I'm going to look into this because I want to know what's up, too.

To create a hero action, follow this tutorial: 

 

 

 

Share this post


Link to post
Share on other sites

@Ant,

Thanks.  May try and create some further Actions now.  Could you post the c# code for the same Hero Action but with also a bool defaulted to false re whether you want the string search to be case sensitive (true) or not.  I can add in the code for the case insensitive bit if you like.  Will really help.  Pls comment it as much as poss thx.

Share this post


Link to post
Share on other sites

@Ant,

Looking forward to you sample code for the above and the guidance / commenting in general on Custom Hero Actions.  In the meantime, in the first post above and here I attach the custom HeroAction 'If (String Contains)' now with all the right things included in the Unity Package - including there HeroAction - and taking in to account your existing amendments.

 

HeroKit Action - If (String Contains) - v1.1.unitypackage

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...