Making programs work together.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ChuckDubya@gmail.com

    #1

    Making programs work together.

    I'm looking to make what's basically a macro for a computer game. But
    I want this "macro" to take information from the game itself, so it's
    not really a macro.

    How do I access the data from my game to use in a program?

  • Bengt Richter

    #2
    Re: Making programs work together.

    On 16 Aug 2005 22:30:51 -0700, ChuckDubya@gmai l.com wrote:
    [color=blue]
    >I'm looking to make what's basically a macro for a computer game. But
    >I want this "macro" to take information from the game itself, so it's
    >not really a macro.
    >
    >How do I access the data from my game to use in a program?
    >[/color]
    How do I access the data behind your question?

    Regards,
    Bengt Richter

    Comment

    • ChuckDubya@gmail.com

      #3
      Re: Making programs work together.

      Example: I'm driving a car in a game and I hit an oil slick so instead
      of me having to lift off the throttle button on the keyboard, I want to
      make a program to disengage the throttle as long as I'm on that oil
      slick. Does that clear anything up?

      Comment

      • Peter Otten

        #4
        Re: Making programs work together.

        ChuckDubya@gmai l.com wrote:
        [color=blue]
        > Example: I'm driving a car in a game and I hit an oil slick so instead
        > of me having to lift off the throttle button on the keyboard, I want to
        > make a program to disengage the throttle as long as I'm on that oil
        > slick. Does that clear anything up?[/color]

        Yes. Here's how to do it:

        import random
        import time

        class Car:
        def throttle(self, on):
        if on:
        print "full throttle"
        else:
        print "on that oil slick again"


        class ThatOilSlick:
        def __contains__(se lf, item):
        return random.random() < .7

        class Game:
        def __init__(self):
        self.car = Car()
        self.thatOilSli ck = ThatOilSlick()
        def play(self):
        while True:
        self.car.thrott le(self.car in self.thatOilSli ck)
        time.sleep(.2)

        if __name__ == "__main__":
        Game().play()

        :-)

        Look here for further information:


        Peter


        Comment

        • Dennis Lee Bieber

          #5
          Re: Making programs work together.

          On 16 Aug 2005 23:24:13 -0700, ChuckDubya@gmai l.com declaimed the
          following in comp.lang.pytho n:
          [color=blue]
          > Example: I'm driving a car in a game and I hit an oil slick so instead
          > of me having to lift off the throttle button on the keyboard, I want to
          > make a program to disengage the throttle as long as I'm on that oil
          > slick. Does that clear anything up?[/color]

          The main question is: do you have access to the game INTERNAL
          DATA... IE, how do you know you hit an oil slick -- what data is
          available from the game that tells you it is an oil slick?

          If all you have to go by is a visual image showing your car skidding
          sideways, you have entered the realm of visual recognition AI -- and
          most experiments in that realm still need cleanly defined road markings,
          they don't handle shiny dark spots covering the road.
          --[color=blue]
          > =============== =============== =============== =============== == <
          > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
          > wulfraed@dm.net | Bestiaria Support Staff <
          > =============== =============== =============== =============== == <
          > Home Page: <http://www.dm.net/~wulfraed/> <
          > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

          Comment

          • Magnus Lycka

            #6
            Re: Making programs work together.

            ChuckDubya@gmai l.com wrote:[color=blue]
            > I'm looking to make what's basically a macro for a computer game. But
            > I want this "macro" to take information from the game itself, so it's
            > not really a macro.[/color]

            That's exactly a macro as the term is used in e.g. MS Office macros
            written in VBA etc. Do you have access to the source code for the game?

            Comment

            • John Machin

              #7
              Re: Making programs work together.

              ChuckDubya@gmai l.com wrote:[color=blue]
              > Example: I'm driving a car in a game and I hit an oil slick so instead
              > of me having to lift off the throttle button on the keyboard, I want to
              > make a program to disengage the throttle as long as I'm on that oil
              > slick. Does that clear anything up?
              >[/color]

              Yes.

              Comment

              Working...