Perform string operation to control the actors position?

I am making a test level, in which i am receiving a movement string from the player like this ( “LRFBLLF” ) for forward, backward, left, and right. I am using the UI widget blueprint to get the string. Now i want to control my actor accordingly. first problem that i face is i am unable to access my widget string variable in the actor blueprint. And second how do access the string character by character till the string length and update the actor position?

i have attached the snap shot of part of my blueprint where i am trying to test the string on actors blueprint. But i get nothing on the screen.
I need help in creating this using blueprints… Plz help me out!

Hi,

First of all could you show us how you set the value to BotStr ? You can expose a variable of your widget by checking “Is Variable” in the designer module of the widget window :

48921-2015-07-03+10_21_30-46.126.130.142+-+remote+desktop+connection.png

This will be accessible outside the widget.

Then to go though a string you need to use GetCharacterArrayfromString and then use a foreach on the array.

I hope it helps :slight_smile:

I am setting the variable in the following manner.

It seems to be set correctly.
Does the game print anytext on the screen or not ? Because it should write :
Server : TEXT HERE
So even if there is no text you should see "Server : ". If you do not check the console output to look for the message of there is nothing there maybe an issue with something else.
You could try to add a text label in your UI Widget and bind it to the BotStr so you could see live what the BotStr is.

No. It just inserts a new line, which is visible by the previous printed string as it get shifted down.

Did you try to debug it to see where the problem starts ?
Does the Append work ? Does the set BotStr work ?
If yes is you Bot 3 UI Widget valid (Not NULL) ? If yes can you get anything else from it ?

yes i have tried debugging it. Everything seems ok. I can print the bot string value from the widget, but i can not get the string value in other blueprint.

How do you get Bot 3 Widget UI ?
Do you create it where you use it ?

yup from the content window. right-click>UI>widget blueprint

It would be simpler to see the project but it might be hard for you to share. Could you show us where you create the widget ? (screenshot)

Yes you created it here but (sorry I wasn’t clear) where do you set it to a variable ? Because you are using a Bot 3 UI Widget variable but how do you set it ?

In other blueprint. Add new variable and its define its type as BotMovementUI object reference.

48930-capture1.png

There it is ! That is your issue.
Here you are creating a variable but it is empty, you do not set it with the reference of the widget.
What you should do is call an event FROM the widget and give the BotStr in the event.

Could you tell how to go about it… I am beginner only to blueprints.

Look at this : Creating Widgets | Unreal Engine Documentation

It will explain how/when to create a widget, set it to the variable and then set it to the screen (to be displayed). :slight_smile:

I can’t find it. It just explains about creating the widgets. Although i am seeing a check box in the widget panel called is variable.

I couldn’t get it in my screen. could you tell me where it could be. or is it a matter or vers

Does this help ?

I am also doing the same thing. Anyway i am able to access the variable in my level blueprint, and not in other widgets blueprint.

I think it is may be because of the fact that widget blueprint is like an abstract class, which gets called at run time. So i have got may way around it. But still thanks for your cordial support. (Y)

But i was wondering if we can access the level variable in other actors blueprint or not?? Cause i was not able to instantiate the object of the level blueprint. What do you think?