How to remove empty items

For general discussion related FlowStone
User avatar
Yuroun
Posts: 27
Joined: Mon Dec 19, 2011 7:32 pm
Location: Tilburg, The Nethlands
Contact:

How to remove empty items

Post by Yuroun »

I'm building a semi modular effect. The user can select an effect on every slot, but when an effect is chosen, then in the other effect slot must the effect removed. I'd build some logic, but I have empty places. How can I remove them?

See my schematic
select-fx.png
select-fx.png (50.42 KiB) Viewed 23827 times

SelectFX.fsm
(2.14 KiB) Downloaded 1153 times
briant1972
Posts: 9
Joined: Mon Jun 11, 2012 4:23 am

Re: How to remove empty items

Post by briant1972 »

I found some ruby code online. Seems to work. Try out the attached module.
Attachments
SelectFX2.fsm
(2.37 KiB) Downloaded 1163 times
Jay
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: How to remove empty items

Post by Jay »

Hi Yuroun

I would do it like below, all one line and no extra bits required ;)

output @SourceString.gsub(@OldPattern,@NewPattern).each_line.reject{|x| x.strip == ""}.join

SelectFX remove empty.fsm
(2.24 KiB) Downloaded 1175 times


Best Regards
User avatar
Yuroun
Posts: 27
Joined: Mon Dec 19, 2011 7:32 pm
Location: Tilburg, The Nethlands
Contact:

Re: How to remove empty items

Post by Yuroun »

Thanks Guys. Both are elegant solutions. I prefer the version of Jay. He modified my Ruby code nicest ;)
Jay
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: How to remove empty items

Post by Jay »

Why thank you Yuroun!

glad it is of use for you m8 :)

Best regards
User avatar
Yuroun
Posts: 27
Joined: Mon Dec 19, 2011 7:32 pm
Location: Tilburg, The Nethlands
Contact:

Re: How to remove empty items

Post by Yuroun »

Jay wrote:Why thank you Yuroun!



Because it's a normal thing to do, If you get some help.

For me it is :D
Last edited by Yuroun on Thu Apr 11, 2013 10:03 am, edited 1 time in total.
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: How to remove empty items

Post by nix »

It's a mannerism in English Yuroun 8D
Or was that a good for a pun?
hehe
User avatar
Yuroun
Posts: 27
Joined: Mon Dec 19, 2011 7:32 pm
Location: Tilburg, The Nethlands
Contact:

Re: How to remove empty items

Post by Yuroun »

nix wrote:It's a mannerism in English Yuroun 8D
Or was that a good for a pun?
hehe


Lol :lol:
User avatar
Yuroun
Posts: 27
Joined: Mon Dec 19, 2011 7:32 pm
Location: Tilburg, The Nethlands
Contact:

Re: How to remove empty items

Post by Yuroun »

Here's the version I had in mind. It's not working perfectly :roll:

SelectFX.fsm
(2.55 KiB) Downloaded 1180 times
Jay
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: How to remove empty items

Post by Jay »

yeh its just a saying Yuroun :D a bit like "well thank you very much"

I see what you mean about not working perfectly, it seems the last column does not always update properly, I will have a look at it and see what i can come up with :)

Best Regards
Post Reply