Page 1 of 3 123 LastLast
Results 1 to 40 of 93
  1. #1

    Lightbulb Setting Up a Rudimentary Chat Box


    This tutorial is confirmed working up to September 2011 UDK.


    This intermediate to advanced level tutorial will cover the steps needed for a rudimentary multiplayer multi-line Chat window that works during gameplay, capturing all keyboard entry, and disallowing the game from capturing keyboard entry while it has focus. It will provide two ways to access the chat input - mouse click, and keyboard command.

    This tutorial assumes you are already very familiar with setting up and using Scaleform and CLIK widgets, and that you have a working mouse cursor in a Scaleform based HUD.

    The tutorial covers UDK networking/replication. I recommend you familiarize yourself with it: http://udn.epicgames.com/Three/ReplicationHome.html

    IMPORTANT: This tutorial also requires the toggle-able mouse tutorial. If you don't have that in your HUD, see this forum post for the tutorial: Adding a Mouse Cursor

    NOTE: You may download all these files pre-built from the Scaleform Sandbox Files thread --> HERE <--.




    Step 1 - Flash File Setup

    Text Input Box
    • Drop a CLIK TextInput widget onto your HUD. (C:\UDK\UDK-2011-09\Development\Flash\CLIK\components\TextInput.FLA )
    • Give it an instance name of chatInput.
    • Open the Component Inspector (CS4) or the Component Parameters rollout (CS5) and enable 'actAsButton'.


    Send Button
    • Next drop a CLIK Button widget next to the TextInput widget. (C:\UDK\UDK-2011-09\Development\Flash\CLIK\components\Button.FLA)
    • Give it an instance name of chatSendBtn.
    • Open the Component Inspector (CS4) or the Component Parameters rollout (CS5) and enter 'Send' in the label field of the button.


    Multi-line Scrollable Chat Log
    • Drop a CLIK Text Area widget above the TextInput widget. (C:\UDK\UDK-2011-09\Development\Flash\CLIK\components\TextArea.FLA)
    • Give it an instance name of chatLog.
    • Open the Component Inspector (CS4) or the Component Parameters rollout (CS5) and disable 'editable'.
    • Drop a CLIK Scroll Bar widget to the right of the TextInput widget. (C:\UDK\UDK-2011-09\Development\Flash\CLIK\components\Scrollbar.FLA )
    • Give it an instance name of chatScrollBar.
    • Select the Text Area, and open the Component Inspector (CS4) or the Component Parameters rollout (CS5) and set the scrollBar field of the Text Area to chatScrollBar.


    The Chat Form
    • Align the four widgets on stage so they are all near each other, forming a box. You can stretch (non-uniform scale) the widgets as needed.
    • Select all four widgets on the stage, right click, and choose Convert to Symbol.
    • Set the Name to chatForm
    • Set the Type to Movie Clip.
    • Enable Export for ActionScript & Export in frame 1.
    • Set the Identifier to chatForm
    • Set the Class to gfx.core.UIComponent
    • Press OK.
    • Delete the chatForm movie clip form the stage, leaving it in the library.


    The Chat Window
    • Copy the file \Development\Flash\CLIK\demos\com\Scaleform\Window .as to \Development\Flash\CLIK\gfx\controls\Window.as
    • Open this class file and change line 7 (the class declaration line) to this:

      Code:
      class gfx.controls.Window extends UIComponent {
    • Open the file \Development\Flash\CLIK\demos\WindowDemo.FLA.
    • Go to the Library panel of this file.
    • Select the WindowSkinned symbol.
    • Right click the WindowSkinned symbol and select Copy.
    • Return to your HUD FLA file.
    • Right click on the stage and select Paste to paste the Window symbol in place.
    • Align the window near the bottom left of the stage.
    • Give it an instance name of chatWindow.
    • With the chatWindow selected on stage, open the Component Inspector (CS4) or the Component Parameters rollout (CS5).
    • Set the formSource to chatForm.
    • Ensure formType is set to symbol.
    • Set maxHeight & maxWidget to 400.
    • Set minHeight and minWidget to 200.
    • Set offsetBottom to 24, offsetLeft to 20, offsetRight to 20, and offsetTop to 46, or whatever works for you after testing.
    • Set title to Chat.
    • Right click the WindowSkinned symbol in the Library Panel and select Properties.
    • Change the Class field to gfx.controls.Window and press OK.
    • Right click the symbol again and choose Component Definition.
    • Change the Class field to gfx.controls.Window and press OK.


    • Save, Publish, and Import your SWF into UDK as usual. You should now have a draggable chat window on the stage, which contains the chat input, chat area, send button, and scrollbar.




    Uploaded with ImageShack.us



    Step 2 HUD Class UnrealScript

    Your HUD Class should extend GFxMoviePlayer.

    Add these new variables to your UnrealScript HUD Class file:

    Code:
    var WorldInfo ThisWorld;
    var SFPlayerController PC;
    
    var array<string> chatMessages; // this will hold all the chat messages
    var bool bChatting;
    
    // These are our CLIK widgets for the chat system
    var GFxClikWidget MyChatInput, MyChatSendButton, MyChatLog;
    Modify your Start()/Init() function as follows (add the red lines):

    Code:
    function Init(optional LocalPlayer player)
    {
        super.Init(player);
        ThisWorld = GetPC().WorldInfo;
    
        Start();
        Advance(0);
    
        // ... other initialization code here ...
    
        
        // Register the HUD with the PlayerController
        PC = SFPlayerController(GetPC());
        PC.registerHUD(self);
    }
    Modify the ToggleCursor() function (from the Mouse tutorial) by adding the red lines of code below.

    Code:
    /** Toggles mouse cursor on/off */
    function ToggleCursor(bool showCursor, float mx, float my)
    {	
        if (showCursor)
        {
    	MouseContainer = CreateMouseCursor();
    	MouseCursor = MouseContainer.GetObject("my_cursor");
    	MouseCursor.SetPosition(mx,my);
    	MouseContainer.SetBool("topmostLevel", true);
        }
        else
        {
    	MouseContainer.Invoke("removeMovieClip", args);
    	MouseContainer = none;	
        }
    	
        if (!bChatting)
        {
    	self.bCaptureInput = showCursor;
    	self.bIgnoreMouseInput = !showCursor;		
        }
        else
        {
    	self.bCaptureInput = true;
    	self.bIgnoreMouseInput = false;
        }
    }
    Now modify the WidgetInitialized() function of your HUD and set up event listeners for mouse click events on the chat text input field and the chat send button:

    Code:
    event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
    {    
        switch(WidgetName)
        {             
            case ('chatInput'):
                MyChatInput = GFxClikWidget(Widget);
                MyChatInput.AddEventListener('CLIK_press', OnChat);		
                break;
    	case ('chatSendBtn'):
    	    MyChatSendButton = GFxClikWidget(Widget);
                MyChatSendButton.AddEventListener('CLIK_press', OnChatSend);
    	    break;
    	case ('chatLog'):
    	    MyChatLog = GFxClikWidget(Widget);
    	    break;
            default:
                break;
        }
        return true;
    }
    Add the OnChat() event handler.

    Code:
    // Event Handler - handles when the player clicks on the chat box text input field.
    function OnChat(GFxClikWidget.EventData ev)
    {
        bChatting = true;
    }
    Add the OnChatSend() function. This function broadcasts the message when the Send button is pressed, and returns control to the game.

    Code:
    function OnChatSend(GFxClikWidget.EventData ev)
    {
        local string Msg;
    
        Msg = MyChatInput.GetString("text");
    
        if (Msg != "")
        {
            PC.SendTextToServer(PC, Msg);
        }
       
        MyChatInput.SetString("text", "");
        self.bCaptureInput = false;
        bChatting = false;
    }
    Now, for the function that updates the chat area, displaying each message received thus far from Broadcast():

    Code:
    function UpdateChatLog(string message)
    {
        local string displayMsg;
        local int i;
    
        chatMessages.AddItem(message);
        
        displayMsg = "";
    
        for (i = 0; i < chatMessages.length; i++)
        {
    	displayMsg @= chatMessages[i];
    	displayMsg @= "\n";
        }
        
        MyChatLog.SetString("text", displayMsg);
        MyChatLog.SetFloat("position", MyChatLog.GetFloat("maxscroll"));
    }
    Add the widget bindings and other important variables in your default properties:

    Code:
    defaultproperties
    {
        WidgetBindings.Add((WidgetName="chatInput",WidgetClass=class'GFxClikWidget'))
        WidgetBindings.Add((WidgetName="chatSendBtn",WidgetClass=class'GFxClikWidget'))
        WidgetBindings.Add((WidgetName="chatLog",WidgetClass=class'GFxClikWidget'))
    
        bIgnoreMouseInput = true;
        bCaptureInput = false;
    }


    Step 3 - GameInfo Class Setup

    Open your GameInfo class.

    Only add these variables to your game info class, if it does not extend UTGame or a child of UTGame, such as UTDeathmatch. You will get a warning on compile, if these variables are already being declared. If so, remove them from your game info class.

    Code:
    var class<BroadcastHandler> BroadcastHandlerClass;
    var BroadcastHandler BroadcastHandler;	// handles message (text and localized) broadcasts
    Next, add this line (in red) to the InitGame() function in your GameInfo class:

    Code:
    event InitGame( string Options, out string ErrorMessage )
    {
        Super.InitGame(Options, ErrorMessage);
        BroadcastHandler = spawn(BroadcastHandlerClass);
    }
    Inside our GameInfo class, we'll override the Broadcast event class from \Development\Src\Engine\Classes\GameInfo.uc

    Code:
    event Broadcast( Actor Sender, coerce string Msg, optional name Type )
    {
        local SFPlayerController PC;
        local PlayerReplicationInfo PRI;
    	
        // This code gets the PlayerReplicationInfo of the sender. We'll use it to get the sender's name with PRI.PlayerName
        if ( Pawn(Sender) != None )
            PRI = Pawn(Sender).PlayerReplicationInfo;
        else if ( Controller(Sender) != None )
    	PRI = Controller(Sender).PlayerReplicationInfo;
    	
        // This line executes a "Say"
        BroadcastHandler.Broadcast(Sender,Msg,Type);
    	
        // This is where we broadcast the received message to all players (PlayerControllers)
        if (WorldInfo != None)
        {
    	foreach WorldInfo.AllControllers(class'SFPlayerController',PC)
    	{
    	    `Log(Self$":: Sending "$PC$" a broadcast message from "$PRI.PlayerName$" which is '"$Msg$"'.");
    	    PC.ReceiveBroadcast(PRI.PlayerName, Msg);
    	}
        }
    }
    Last of all, add these lines to your GameInfo class' default properties, being sure to modify them with your class names:

    Code:
    defaultproperties
    {
        PlayerControllerClass=class'SFPlayerController'
        BroadcastHandlerClass=class'Engine.BroadcastHandler'
        HUDType=class'SFTutorial.SFHudWrapper'
        bUseClassicHUD=true
    }


    Step 4 - PlayerController Class Setup

    Create/Open the PlayerController class (in this case: SFPlayerController):

    Code:
    class SFPlayerController extends UTPlayerController;
    First we'll create a function that registers the HUD inside the PlayerController so we can easily call functions in the HUD from the PlayerController:

    Code:
    var SFHud MySFHud;
    
    function registerHUD(SFHud hud)
    {
        MySFHud = hud;
    }
    The next function is used to send a message to the server:

    Code:
    exec function SendTextToServer(SFPlayerController PC, String TextToSend)
    {
    	`Log(Self$":: Client wants to send '"$TextToSend$"' to the server.");
    	ServerReceiveText(PC, TextToSend);
    }
    This function is used to receive a server message and then broadcast it:

    Code:
    reliable server function ServerReceiveText(SFPlayerController PC, String ReceivedText)
    {	
        WorldInfo.Game.Broadcast(PC, ReceivedText, 'Say');
    }
    Last of all, we need to create a client function that listens for broadcasts from the server, and routes them to the chat window:

    Code:
    reliable client function ReceiveBroadcast(String PlayerName, String ReceivedText)
    {
        `Log(Self$":: The Server sent me '"$ReceivedText$"' from "$PlayerName$".");
        MySFHud.UpdateChatLog(PlayerName @ ": " @ ReceivedText);
    }


    OPTIONAL - Enable Chatting Via Keyboard Command (Pressing Enter)

    For this step, we'll use the Enter key to begin chatting, as well as sending (completing) the chat message. You can however use whatever key you want. For a list of potential keys, see this post: http://forums.epicgames.com/showthread.php?t=756159

    Step 1 - Add Key Binding

    Open DefaultInput.ini, and add the following line:

    Code:
    .Bindings=(Name="Enter",Command="ChatHandler")
    NOTE: You will need to comment out or delete the following line for the pressed key to work for chatting:

    Code:
    .Bindings=(Name="Enter",Command="GBA_Use")
    Step 2 - HudWrapper Class Setup

    Open your HUDWrapper. This is the class that instantiates the HUD. Add the function that will be executed on key press.:

    Code:
    exec function ChatHandler()
    {
        HudMovie.ToggleChat(); // Replace HudMovie with the reference name of your HUD movie.
    }
    Step 3 - HUD Class Setup

    Open your HUD class.

    First, we need to ensure that our chosen key is never captured as input by our HUD movie. We do this by adding it to the focus ignore key list. Add this line to your Start()/Init() function:

    Code:
        AddFocusIgnoreKey('Enter');
    Next, add a function that will enable chatting via keyboard command. This function is called by the HudWrapper:

    Code:
    function ToggleChat()
    {
        if (!bChatting)
        {
    	self.bCaptureInput = true;
    	OnChat();
        }
        else
        {
    	self.bCaptureInput = false;
    	OnChatSend();
        }
    }
    Next, modify the OnChat() and OnChatSend() function parameters so that they are optional:

    Code:
    function OnChat(optional GFxClikWidget.EventData ev)
    function OnChatSend(optional GFxClikWidget.EventData ev)
    Now modify the OnChat() function by adding this line of code:

    Code:
    MyChatInput.SetBool("focused", true);
    And finally, modify the OnChatSend() function with this line of code:

    Code:
    MyChatLog.SetBool("focused", true);

    Recompile scripts, and test your HUD.
    Last edited by Matt Doyle; 10-10-2011 at 05:20 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Posts
    46

    Default

    First of all, thanks for this great tutorial!

    I have followed each step and everything compiled without any problem. However in game, when I type something and press send button nothing shows up. I checked the log window and a warning message shows as:

    Function MyGame.SFHud:OnChatSend:003D
    ScriptWarning: Accessed None 'MyChatInput'

    What could be the problem? I tried changing instance names of widgets but it didn't help.
    Thanks.

  3. #3

    Default

    Sorry there were several typos in the tutorial & the sample SFHud file. I have corrected the typos. Just make sure your code matches the new sample files.

  4. #4
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Posts
    46

    Default

    Thanks, it's working perfectly.

  5. #5

    Default

    Simple amazing just what i was needing thanks matt!

  6. #6

    Default

    awesome, thanks

  7. #7
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    140

    Default

    I'm kind of trying to implement a textArea with a working scrollbar (I haven't really reached the implementeation yet), and it behaves somewhat iffy. the TextArea has the scrollbar defined as it's scrollbar, and I can definitely see the Scrollbar being updated as the text starts to overflow the textArea, however whenever I try to scroll to the end, either by pressing the arrows or dragging the scrollbutton the textArea becomes blank and the scrollbutton disappears until i append the text in the textarea again, then it scrolls to the top again (which makes it impossible to see the overflowed text). I don't know if it's my way of implementation that causes this problem, but here is what i have:
    AS Code for updating the chat:
    Code:
    function AppendChat(msg:String)
    {	
    	chatMsg.push(msg);
    	gameLobby_mc.chatForm.chatLog.textField.text = "";
    	for(var a=0; a < chatMsg.length; a++)
    		gameLobby_mc.chatForm.chatLog.textField.text = gameLobby_mc.chatForm.chatLog.textField.text + "\n" + chatMsg[a];
    //chatMSG holds ALL the strings that gets send to the AppendChat function
    		
    }
    Oh, and it should also be noted that i followed the tutorial BUT I didn't implement the movable window as i want the chat to be static
    Spearhead Entertainment
    ------------------------
    "If you get a setback, don't take a stepback, but prepare and make place for your comeback" - my motto
    charleon.newgrounds.com - My composed music, I live to inspire

  8. #8

    Default

    Have you tried setting the position of your scrollbar after the text area is updated?

    gameLobby_mc.chatForm.chatLog.position = gameLobby_mc.chatForm.chatLog.maxscroll;

  9. #9

    Default

    Your AppendChat function has some problems with it. Use this code instead:

    Code:
    function AppendChat(msg:String)
    {	
        var newMsg:String
        chatMsg.push(msg);
        newMsg = "";
    	
        for(var a=0; a < chatMsg.length; a++)
        {
    	newMsg += chatMsg[a];
    	newMsg += "\n";
        }
    	
        gameLobby_mc.chatForm.chatLog.text = newMsg;
        gameLobby_mc.chatForm.chatLog.position = gameLobby_mc.chatForm.chatLog.maxscroll;
    }

  10. #10

    Exclamation In need of assistance please :) ?

    Hello again folks,

    Just gone through this Tutorial... all went well no compile errors, however as the topic above suggests "Nothing Happens" once the send button is pressed.

    The flash is working fine, I have a draggable window I can type in the appropriate boxes on screen (so mouse cursor is fine).

    The only bit I'm a bit confused on is the main bit probably another blonde moment, as follows.

    ***
    // The important part is in red.
    SFHudWrapper(PC.myHUD).HudMovie.UpdateChatLog(PRI. PlayerName@": "@Msg);
    ***

    Now all of my files are names as the ones attached here, I have 99.9% checked for typos as it compiles well but still not working.

    Any input greatly appreciated.

    Thx
    Last edited by cecilbergwin; 08-05-2011 at 09:38 AM.

  11. #11

    Default

    This tutorial no longer works as of the June build of UDK. Something has changed, but I don't know what. I am seeing alot of Accessed None errors in the log, regarding the player profile. That is in a bare bones UDK install, so it's not Scaleform related.

  12. #12

    Default

    Ah I see ... Thank you Matt for your response, do you know of any other methods what are used for example what I could look at, it was pretty much exactly what I wanted aswell.

    Regards

  13. #13

    Default

    ++ To anybody else reading this thread who have or are working on a simple chat panel like this, I would really appreciate any ionput here or advice how you folks are going about this.

    Many Thx (2 days @ work 1 more to go) before some more free time.

  14. #14
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    After following your tutorial and also getting some help on a few other errors, i have ran into another problem. When the chat form loads the chat input doesnt accept input. I can click on it and it shows a cursor but i cant type anything into it. I can post some code or whatever is needed, thanks for any help

  15. #15

    Default

    Does it work in the Scaleform player, when you launch it using the Scaleform Launcher in Flash?

  16. #16
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    Yeah it works in Flash

  17. #17

    Default

    That tells us the problem is in your UnrealScript most likely. I can confirm the tutorial works. You'll need to go back and ensure you've followed every step correctly.

    That being said, I have also recently (today) changed the tutorial. It no longer uses a FilterButtonInput() function, but instead relies on the mouse tutorial I created.

  18. #18
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    okay thank you, ill check out the updates you made and let you know how it goes

  19. #19
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    im getting an error with the update to the tutorial

    [0004.05] Error: C:\UDK2\Development\Src\EndGame\Classes\GFxTeglegF rontEnd.uc(86) : Error, 'OnChatSend' mismatches delegate 'EventListener'

    on these lines

    Code:
    function OnChatSend()
    {
    	local WorldInfo ThisWorld;
    	local string Msg;
    	
    	ThisWorld = GetPC().WorldInfo;
    	Msg = MyChatInput.GetString("text");
    	
    	if (Msg != "")
    	{
    		ThisWorld.Game.Broadcast(GetPC(), Msg, 'Say');
    	}
    
    	MyChatInput.SetString("text", "");
    	self.bCaptureInput = false;
    	bChatting = false;
    }

  20. #20

    Default

    Sorry. That should be:

    Code:
    function OnChatSend(GFxClikWidget.EventData ev)
    Last edited by Matt Doyle; 09-07-2011 at 05:12 PM.

  21. #21
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    when i change that i get this warning

    [0004.18] Log: C:\UDK2\Development\Src\EndGame\Classes\GFxTeglegF rontEnd.uc(96) : Warning, WidgetInitialized: Missing return value
    does that matter?

  22. #22

    Default

    Try adding

    Code:
    return true;
    to the end of your WidgetInitialized function, before the last (closing) bracket }.

    So...

    Code:
    event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
    {
        switch(WidgetName)
        {
            // stuff in here...
        }
        return true;   
    }

  23. #23
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    well that fixed the warning but my mouse cursor and the chat box and now not working.

    it loads the mouse cursor but it doesnt move, it does move however when i hit escape and the little pause menu with resume and exit pops up.

    When i got to launch the Chat program it no longer pops up either. i dont know whats going on now lol

  24. #24

    Default

    Sorry to hear you're having so many issues. In this case, my advice to you is to download the working Scaleform Sandbox files. You'll find them in the thread entitled Scaleform Sandbox files.

  25. #25

    Default

    Hello Matt Doyle,
    thanks for your efforts and sharing this Code (and Sandboxfiles). I appreciate reading your posts alot.

    I woud like to share some Feedback:
    (Sandboxfiles + UDK 2011-08)
    ChatLog works in singleplay. On a dedicated server/client environment the ChatLog fails to catch the broadcasted message:

    PHP Code:
    ScriptWarningAccessed None 'myHUD'
        
    SFTutorialGame SF-Tutorial.TheWorld:PersistentLevel.SFTutorialGame_0
        
    Function SFTutorial.SFTutorialGame:Broadcast:012D 
    This Log belongs to the dedicated server, the client is silent.

    As a second issue, I cant get the ChatInput to capture keys in my personal project environment (UDK 2011-06, extending from UDKGame). I compared the sandboxfiles with my version of it bit by bit, but couldn't find the difference. I can click it and the TextFocus-Cursor appears, but I'm not able to type into, like in the sandbox-demo. Everything else works like it. I used console "say [str]" to test it, and the ChatLog receives the message. Well, only in singleplay, for ded.-server/client it's same issue like above...

    Thanks for reading.
    blutdieb

  26. #26

    Default

    I'll look into it when I get a chance (the server/client issue). As for your other issue, are you setting bCaptureInput = true to be able to type into it. I set it to true in my mouse code (self.bCaptureInput = true), when I hold down left shift to display the mouse cursor.

  27. #27

    Default

    I have rewritten parts of the code, and tested in a multi-player environment. It works completely now. Not sure about dedicated server, but it does work in a non-dedicated server/client environment, where both instances (the server & the client) were running on the same machine.

  28. #28

    Default

    Hello Matt Doyle,

    thanks for the quick fix! Works like a charme on a dedicated server/client environment.

    Awesome!!! I guess many ppl will like it

    @input: still the same, still have to use console to post a chat message. I tried "bCaptureInput = true;" in defaultproperties and "self.bCaptureInput = true;" in init(). It captures W,A,S,D binds and so on ... Since I'm using a different mousepointer approach (always visible), but I will post back tomorrow after some further investigations.

    blutdieb.

  29. #29

    Default

    Great! glad it works (the networked chat part). As for the input capturing issues, I don't know what to say. It works on my end. Try downloading the Sandbox files (they are my working files) and compare them to yours. Let me know how it goes.

  30. #30
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    Im having the same chat input problem as blutdieb. None of my text boxes will capture any input. Ive gone over the sandbox files and as far as I can tell I dont have anything wrong. I don't have my game files exactly like yours, I dont have a SFHud and a SFMenu i just put them in one file. Could that be causing my problems?

  31. #31

    Default

    Nothing in your movie will capture input if you don't set:
    Code:
    self.bCaptureInput = true;
    The problem is that when this is the case, you can't control the game. That is why my tutorial only shows the mouse when you hold down the left shift key, and when you do this, it sets self.bCaptureInput = true;

  32. #32
    MSgt. Shooter Person
    Join Date
    Jun 2011
    Posts
    109

    Default

    well my chat is outside of the actual game so could i just set bCaptureInput to true until i load the game?

  33. #33

    Default

    Yes, you can. In that case, set it in your defaultproperties of the HUD class:

    Code:
    defaultproperties
    {
        bCaptureInput = true;
    }

  34. #34

    Default

    Hello Matt Doyle,

    sorry for the delay. I decided to rewrite it from scratch. Here is the result of my investigation:

    I have a Setup like this:

    Code:
    HudWrapper
    Ž
    +-- Cursor (extends GFxMoviePlayer)
    Ž
    +-- Hud (extends GFxMoviePlayer)
    Ž
    etc.
    As you can see I'm using multiple and seperated layers to achieve my hud-solution. With this config, the cursor is always on top and re-useable for different hud types. There is no problem with the interaction of each layer. But exactly this config seems to be responsible for the issue of not being able to type into the inputtextfield I got: The cursor can activate the inputtextfield to give it focus. Nothing more.
    As far as I can tell for now, "bCaptureInput" seems to work only for the most upper layer. When I switch the order between cursor and hud, I'm able to type into! Well, the cursor lies now under the hud-layer...

    I guess I have two options (in order of my preference):
    1.) Finding a solution to have the input-capturing work while the cursor-layer is ABOVE the hud-layer, if possible at all? No clue yet!
    2.) Build the cursor into my hud (and each other type of hud like in your sandboxdemo) and losing the aspect of modularity.

    Maybe you have an idea how to achieve option 1.?
    thanks,
    blutdieb.

  35. #35

    Default

    Hello again,

    sorry for asking some more questions (hope you don't mind):
    1.) How would you activate/deactivate the focus of the textfield via unrealscript (for example: if I bind a command "toggleChat" via DefaultInput.ini)?
    2.) How would you prevent the cursor from moving, while it's not visible (so, that it remains on the same location, until it becomes visible again)?

    Thanks alot, again!
    blutdieb.

  36. #36
    MSgt. Shooter Person
    Join Date
    Jul 2009
    Posts
    139

    Default

    In this example does pressing "Enter" send the text as well? I don't see how that works if it does.
    Hey guys - Oh Big Gulps huh? Allright!...........Welp cya later.

    http://www.youtube.com/watch?v=praFGD51ih8

  37. #37

    Default

    Have you tried adding bCaptureInput = false to the cursor movie?

    Activating/Deactiving a textfield's focus is simple:

    MyTextField.SetBool("focused", true);

    No, Enter key presses do not send the text. You must use the Send button.

  38. #38

    Default

    Hello Matt Doyle,

    thanks for the quick response!

    Quote Originally Posted by Matt Doyle View Post
    Have you tried adding bCaptureInput = false to the cursor movie?
    I already tried that before, doesn't seem to work for me. *sigh

    Quote Originally Posted by Matt Doyle View Post
    Activating/Deactiving a textfield's focus is simple: MyTextField.SetBool("focused", true);
    Nice, this works! the state visually changes but the inputindicator of the textfield remains blinking when setting it to 'false' ... and the textfield is still capturing input. Seems that I have missed something?

    Quote Originally Posted by Matt Doyle View Post
    No, Enter key presses do not send the text. You must use the Send button.
    I'm just working on that part, will share it when it's done.

    thanks alot,
    blutdieb.

  39. #39

    Default

    Try setting focus to something else, instead of setting focused false on the textfield.

  40. #40

    Default

    Hrhr, that did the trick! Nice! Thx alot!


 
Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.