Announcement

Collapse
No announcement yet.

Need help with scripting

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

    Need help with scripting

    I want to have my Joystick1 button to perform MoveForward when I press it - and then MoveBackward - on either when I release the button or when I press it again.

    I've tried some stuff, but nothing will work so far. Here's a bit of it:

    Aliases[36]=(Command="MoveForward|OnRelease set input Joy1 MoveBackward",Alias="jo1")
    Aliases[37]=(Command="MoveBackward|OnRelease set input Joy1 MoveForward",Alias="jo1")

    Then I have two *.txt files containing:

    jo1
    onrelease set input Joy1 exec joy2.txt
    -
    jo2
    onrelease set input Joy1 exec joy1.txt

    And, of course, I have Joy1=exec joy1.txt in the User.ini again.

    Is it even possible to make this with move command?

    Any help would be greatly applauded :noob:

    #2
    I forgot to say, I got this Saitek Cyborg Evo joystick today.
    Maybe something can be done with macros?

    I know nothin' about the stick. I just got it today.

    Comment


      #3
      Re: Need help with scripting

      Originally posted by McFly
      I want to have my Joystick1 button to perform MoveForward when I press it - and then MoveBackward - on either when I release the button or when I press it again.

      I've tried some stuff, but nothing will work so far. Here's a bit of it:

      Aliases[36]=(Command="MoveForward|OnRelease set input Joy1 MoveBackward",Alias="jo1")
      Aliases[37]=(Command="MoveBackward|OnRelease set input Joy1 MoveForward",Alias="jo1")

      Then I have two *.txt files containing:

      jo1
      onrelease set input Joy1 exec joy2.txt
      -
      jo2
      onrelease set input Joy1 exec joy1.txt

      And, of course, I have Joy1=exec joy1.txt in the User.ini again.

      Is it even possible to make this with move command?

      Any help would be greatly applauded :noob:

      OK, you've made some kinda silly mistakes there as it appears in your post. To further compound the problem, you've conflated two completely different methods of achieving the desired effect.

      For the first method:

      Errors: You've got two aliases with the same name ("jo1") -- that's bad. Further, your OnRelease command doesn't set up the next OnRelease.

      Here's how it should look:

      Code:
      Aliases[36]=(Command="MoveForward|OnRelease set input Joy1 jo2",Alias="jo1")
      Aliases[37]=(Command="MoveBackward|OnRelease set input Joy1 jo1",Alias="jo2")
      Then bind Joy1 to the alias "jo1" or "jo2," doesn't really matter since it's cyclic. No need for text files on that one.


      For the second method:

      Errors: Your txt files don't contain the movement commands. Also, to run those txt files you need the "exec" command. To set that one up, it would look like this:

      Raw Keybinding:
      Code:
      joy1 = moveforward | onrelease exec backswitch
      Contents of "backswitch.txt", located in the UT2004/System directory:

      Code:
      set input joy1 movebackward | onrelease exec forwardswitch

      Contents of "forwardswitch.txt", again located in UT2004/System:

      Code:
      set input joy1 moveforward | onrelease exec backswitch
      There is no need to create any aliases with this method.




      Either one of these will work, although why that particular bind is worth the trouble to you I'll never know :haha:. I personally recommend using method 1 (the aliases) since it's less confusing to work with and probably requires less of your CPU's attention.

      Anyway, gl+hf, and welcome to the wacky world of UT- series scripting.

      Comment


        #4
        Great, thanks.
        I'll try this as soon as I've sorted out my joystick moving forward non-stop.

        Btw, the two "jo1" aliases isn't true. I just copied the same twice in here.
        In reality, there are two different names for the aliases. (but that doesn't matter anyway, as you've pointed out )

        Comment


          #5
          Method #1 doesn't work.
          Method #2 only allows me to move forward.


          Gonna try some other combination.

          Now I just need to fix the **** joystick.

          Comment


            #6
            Method#2 won't work as multiple commands separated with a "|" won't work with exec *.txt.

            The first method should work tho', it will alternate between moveforward and backward. (Mind you, you will be unable to dodge..forwards and backwards.. o/c).

            For the second method to work you need an alias for the part after the "set" bit in the *.txt.

            Comment


              #7
              Originally posted by Ickle
              Method#2 won't work as multiple commands separated with a "|" won't work with exec *.txt.
              Didn't know that... thanks for the tip.

              Just to kibbitz, would it work if you wrote the .txt file this way:

              Code:
              moveforward
              onrelease exec <othertextfile>
              ?


              BTW, srry to hear it didn't pan out McFly . Something you might try is using the alias scheme with a button on your keyboard, just to make sure it's joystick related...

              Comment


                #8
                Originally posted by Ickle
                Method#2 won't work as multiple commands separated with a "|" won't work with exec *.txt.

                The first method should work tho', it will alternate between moveforward and backward. (Mind you, you will be unable to dodge..forwards and backwards.. o/c).

                For the second method to work you need an alias for the part after the "set" bit in the *.txt.
                It kinda does, if I use Jump and Fire instead of moveforward/backward. I get to jump with it.
                But for soem reason, it will not have any effect when using moveforward/movebackward.

                Comment


                  #9
                  It would would like this:

                  textfile1.txt
                  Code:
                  set input joy1 mb
                  user.ini
                  Code:
                  Aliases[#]=Command="moveforward | OnRelease exec textfile2.txt",Alias="mb"
                  textfile2.txt
                  Code:
                  set input joy1 mf
                  user.ini
                  Code:
                  Aliases[#+1]=Command="movebackward | OnRelease  exec textfile1.txt",Alias="mf"
                  I think....but i seriously don't recommend exec *.txts, you get a momentary pause as the .txt is exec-ing. Plus it's alot more fussy.


                  And to answer the original question: I don't think it's possible to bind a key to do a "this" or "that" command (move backwards either OnRelease or 2nd press).

                  And-and another thing, Movebackwards requires the key to be pressed: you can't "hold OnRelease".


                  Bleh, what do i know?!??! All this is I think......

                  Comment

                  Working...
                  X