Making programs work together.

Discussion in 'Python' started by ChuckDubya@gmail.com, Aug 17, 2005.

  1. Guest

    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?
    , Aug 17, 2005
    #1
    1. Advertising

  2. On 16 Aug 2005 22:30:51 -0700, wrote:

    >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?
    >

    How do I access the data behind your question?

    Regards,
    Bengt Richter
    Bengt Richter, Aug 17, 2005
    #2
    1. Advertising

  3. Guest

    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?
    , Aug 17, 2005
    #3
  4. Peter Otten Guest

    wrote:

    > 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?


    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__(self, item):
    return random.random() < .7

    class Game:
    def __init__(self):
    self.car = Car()
    self.thatOilSlick = ThatOilSlick()
    def play(self):
    while True:
    self.car.throttle(self.car in self.thatOilSlick)
    time.sleep(.2)

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

    :)

    Look here for further information:
    www.catb.org/~esr/faqs/smart-questions.html

    Peter
    Peter Otten, Aug 17, 2005
    #4
  5. On 16 Aug 2005 23:24:13 -0700, declaimed the
    following in comp.lang.python:

    > 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?


    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.
    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
    Dennis Lee Bieber, Aug 17, 2005
    #5
  6. Magnus Lycka Guest

    wrote:
    > 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.


    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?
    Magnus Lycka, Aug 17, 2005
    #6
  7. John Machin Guest

    wrote:
    > 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?
    >


    Yes.
    John Machin, Aug 17, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    12
    Views:
    1,618
    Dave Thompson
    Jan 10, 2005
  2. Daniel Bickett
    Replies:
    2
    Views:
    370
    David Bolen
    Dec 30, 2004
  3. Coca
    Replies:
    7
    Views:
    724
    Aidan Grey
    Aug 24, 2004
  4. fuli open
    Replies:
    8
    Views:
    314
    Jukka K. Korpela
    May 9, 2007
  5. Mathew
    Replies:
    4
    Views:
    235
    Mathew
    Aug 4, 2011
Loading...

Share This Page