Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: kiriri on June 20, 2012, 04:26:01 PM
-
hey,
I need to separate 1 string into 3 as following:
string 1 needs to be from the beginning of the string to the x-th space
string 2 needs to be from the x-th space to the n-th space.
string 3 needs to be the rest.
I thought I could realize this by first writing an index of (char) action, and then getting the substrings based on the index.
However, there's scarcely even a single sentence about this on the api reference and I am somehow not getting started :S .
On top of that I want to output the strings as if they were one string, so I need to calculate their size, which I recon GUIStyle.CalcSize can do. But how can I reference a GUI to it? It's not like there are any GUI-variables in PlayMaker, so I'm somewhat at a loss.
I would really appreciate some help :)
Thanks,
kiriri
-
Hi,
you should look at this thread for splitting string into an array and work with it then.
http://hutonggames.com/playmakerforum/index.php?topic=891.0 (http://hutonggames.com/playmakerforum/index.php?topic=891.0)
I would split your string in an array, and then access your 3 chunks conveniently with indexing in the array for the xth and nth split.
As for the calcsize, I guess i'ts going to be tricky in playmaker, I don't see right now how this can be achieved, maybe someone will step in with a solution.
bye,
Jean
-
wow that worked perfectly! I really have to learn all your awesome arrayMaker actions by heart :D
Now I'll just have to find a way to print the three strings as one flawless line... Anyways, thansk a lot, your action has brought me a lot closer to the goal :)
-
since I desperately need this calcSize to work, I thought I could achieve it by implementing it directly into the GUILabel FSM. However, as always, I'm having a lot of difficulties. Why isn't the following working?
GUILayout.Label(new GUIContent(text.Value, image.Value, tooltip.Value), style.Value, LayoutOptions);
GUIStyle go = style.Value;
Vector2 size = go.CalcSize(GUIContent);
Sorry about my incomprehension, I really haven't quite grasped the concept of converting variables between playmaker and unity and the lack of any example for this function doesn't make it easier :S
-
Hi,
Yeah, ArrayMaker is mandatory in my opinion :) I made it because I needed it. Working with array is at the core of any programming whatever the subject.
re calcsize, Allow me few days to work on that, I am sure we can work something out.
bye,
Jean
-
sounds great! For now I'll just have to write a hardcode script for the GUI print, but I fear that my employer wouldn't like it so I really am glad you're giving everyone such a great support :)
-
Thanks,
and don't hesitate to get back to me if I forget, the forum and demand it getting bigger and bigger, can't keep up now ;D
bye,
Jean
-
undoubtably understandable ;)
That's btw also the reason why I'm bumping my posts all the time. I'm normally no bumper you see.
So asking bluntly: Has anyone created a way of doing this? I know I have some actions lying around which I never share because they're to specific to help anyone but me.. maybe someone has made this already ? :-\
-
Hi,
Ok, not really able to find a way out of this as a pur action because I can't access GUIStyles. the GUIStyle is not a type that can be displayed in the action interface and it's not a type we can reference in a FSMObject variable so currently I am stuck with this, I can't see a way to do this with playmaker only unfortunatly.
Bye,
Jean
-
I see... maybe Alex can do something about this? Until then I surrender and stick to my hardcode for this :S
Is it possible to move this to the feature request forum?
-
Hi,
I sent an email about this to Alex already, we'll see.
I hope for future update where we will have complete control over the action interface, that will open new perspective, basically allowing very powerful action ui.
bye,
Jean
-
since I desperately need this calcSize to work, I thought I could achieve it by implementing it directly into the GUILabel FSM. However, as always, I'm having a lot of difficulties. Why isn't the following working?
GUILayout.Label(new GUIContent(text.Value, image.Value, tooltip.Value), style.Value, LayoutOptions);
GUIStyle go = style.Value;
Vector2 size = go.CalcSize(GUIContent);
Sorry about my incomprehension, I really haven't quite grasped the concept of converting variables between playmaker and unity and the lack of any example for this function doesn't make it easier :S
Sorry for the delay. You're on the right track here, but you need to get the GUIStyle given its name:
http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle-operator_GUIStyle.html
So this should work (untested):
// create the GUIContent
GUIContent guiContent = new GUIContent(text.Value, image.Value, tooltip.Value);
// get the named style from the current skin
GUIStyle style = GUIStyle(style.Value);
// get the size of the content if drawn with this style
Vector2 size = style.CalcSize(guiContent);
When I get a chance I'll make a CalcSize action, or maybe add Store Size to the GUI actions...
-
Hi,
Thanks Alex, I missed that operator! the action is now up:
http://hutonggames.com/playmakerforum/index.php?topic=1864.0 (http://hutonggames.com/playmakerforum/index.php?topic=1864.0)
a series of similar function is available, if you need them, don't heistate to request them:
http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle.html (http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle.html)
Bye,
Jean