Announcement

Collapse
No announcement yet.

keyevent doesnt work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    keyevent doesnt work?

    i make an interaction with the keyevent function but the keyevent functionnot runs. it shows the "checkkey On <-------- done" and thats it not more.

    any idea why? or a solve for me?

    Code:
    class CheckKeys extends interaction;
    
    event Initialized()
    {
     log("checkkey ON<---------Done");
    }
    
    event NotifyLevelChange()
    {
     Remove();
    }
    
    function Remove()
    {
     Master.RemoveInteraction(self);
    }
    
    function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta)
    {
    
     local string pKey, KeyContent; //, Alias;
     
     log ("keyevent<-------------- done");
     if (Action == IST_Release) //IST_Press
      {
        pKey = caps(ViewportOwner.Actor.ConsoleCommand "KEYNAME"@Key));
         log("pkey="@pKey);
         Keycontent = caps(ViewportOwner.Actor.ConsoleCommand("KEYBINDING"@pKey));
         log("KeyContent="@KeyContent);
        if (InStr(KeyContent,"FIRE")
          ViewportOwner.Actor.ConsoleCommand("set Input"@pKey@"suicide");
    
      }
    
    defaultproperties
    {
     bActive=True
     bVisible=false
     bRequiresTick=False
     bNativeEvents=True
    }
    ---------------------------------------------------
    edit :

    i add the interaction from my replicationinfo class



    Code:
    simulated function Tick(float DeltaTime)
    {
     local Playercontroller pc;
    
     PC = Level.GetLocalPlayerController();
    
     if (PC != None  && Checkkeys == none && !PC.PlayerReplicationInfo.bOnlySpectator && !PC.PlayerReplicationInfo.bisSpectator && !pc.PlayerReplicationInfo.bbot)
        {
            checkkeys=checkkeys(PC.Player.InteractionMaster.AddInteraction("keymutator.checkkeys", PC.Player));
        }
    
    }
    why does the keyevent function do nothing?

    bActive is true who is the misstake?

    #2
    Keyevent does work :sour:
    You really need to look over your code.
    I tried your code and got 4 compile errors, I have no idea how your even running this.

    this is your fix:

    Code:
    function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta){
    	local string pKey, KeyContent;
    	if (Action == IST_Release) {
    		pKey = caps(ViewportOwner.Actor.ConsoleCommand("KEYNAME"@Key));
    		Keycontent = caps(ViewportOwner.Actor.ConsoleCommand("KEYBINDING"@pKey));
    		if (InStr(KeyContent,"FIRE")>0 ){
    			ViewportOwner.Actor.ConsoleCommand("set Input"@pKey@"suicide");
    			return true;
    		}
    	}
    	return false;
    }
    When ever your press the alt fire, you die. Is that what you are trying to acheive?

    Comment


      #3
      you got this compile errors because i forgot to post all necessary of my code....sorry.

      and no the suicide command is not what i want its only for testing.

      and i see if (InStr(KeyContent,"FIRE") <--- the check is missing ^^ lol this is at my code but i deleted it here!?

      Comment


        #4
        So is it working, since you can now send any key command to the console?

        Comment


          #5
          no its not working....

          its always not running the whole keyevent function.

          ScriptLog: checkkey ON<---------LOG
          ScriptLog: checkkey ON<---------LOG

          thats all what i see at my logfile but the other log entries

          log ("keyevent<-------------- done");
          log("pkey="@pKey);
          log("KeyContent="@KeyContent);

          are not written!?!?

          ok i found a mistake at teh variables it must call

          function bool KeyEvent(OUT EInputKey Key, OUT EInputAction Action, float Delta) (shame on me for that)

          i forgot the OUT. ok then i test again but nothing happens...all the same the function don't run.

          with or without simulated all the same.

          Comment

          Working...
          X