Author Topic: AI-ing (.py files, coding, nose-orienting R+D, and help)  (Read 235622 times)

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #300 on: January 04, 2010, 12:53:10 AM »
PillarPlus uses range and WhipperPlus can use SZ's


I played around with Whippers last night there is lots of small tweaks you can do to it to changes actions  :mrgreen:

Offline 123savethewhales

  • *
  • Posts: 2923
  • Rep: 30
  • Friendship is Magic
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #301 on: January 04, 2010, 01:02:11 AM »
The problem I am having with PillarPlus is that the front is absorbing too much impact.  I wanted the damage to be distributed more evenly on all 4 side (making it harder for a chassis kill).

I can sent you to bot if you want to take a look at it.

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #302 on: January 04, 2010, 02:42:04 AM »
maybe try the .bot files and see if any are misspelled. and the picture wouldn't crash the game, the place where the pic would be would be white if it's misspelled.

Well I changed the picture and nothing else and it worked.
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #303 on: January 04, 2010, 04:35:15 AM »
I can sent you to bot if you want to take a look at it.

I would love to help but with 34+ robots asking for AI in CC3 I really cant at this stage sorry

could always do it with whipperplus and a whipzone SZ?

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #304 on: January 06, 2010, 12:48:09 PM »
I've just written Tractor.py, a Plow variant based of Spinner.py

Code: [Select]
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class Tractor(AI.SuperAI):
    "Spins in plow style"
    # - Works just like Spinner.py but with plow incoroporated into it.
    # - Correct weapon ID numbers will help.
    # - No extra stuff needed in the bindings.
    name = "Tractor"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
       
        self.spin_range = 3.0
       
        if 'range' in args:
            self.spin_range = args.get('range')

        self.tactics.append(Tactics.Engage(self))

    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        if self.weapons:
            # spin up depending on enemy's range
            enemy, range = self.GetNearestEnemy()
           
            if enemy is not None and range < self.spin_range:
                self.Input("Spin", 0, 1)
            elif self.GetInputStatus("Spin", 0) != 0:
                self.Input("Spin", 0, 0)
           
        return AI.SuperAI.Tick(self)

    def RobotInRange(self, robot_id):
        "Return tuple of (part-of-robot-in-range, chassis-in-range)"
        # GetLastDamage returns:  component damaged, amount, at time, by player, by component
        range = self.GetDistanceToID(robot_id)
        if range < self.spin_range:
            damage = self.GetLastDamageReceived()
            if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
                return (True, True)
               
        return (False, False)
       
    def LostComponent(self, id):
        #print "Lost Component!"
        return AI.SuperAI.LostComponent(self, id)

    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)

    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)
           
    def Disable(self,btarget):
        # Disables opponent by charging it at an angle
        # we use a different angle (depending on the size of the opponent!)
        # if target is equal in size, the plow weapon charges are more direct

        if btarget > self: self.Turn(79)
        else: self.Turn(-79)
        if btarget < self: self.Turn(35)
        else: self.Turn(-35)
        if btarget == self: self.Turn(90)
        else: self.Turn(-90)
        if self.target: self.Turn(360)
       
        return AI.SuperAI.Disable(self, btarget)
   
AI.register(Tractor)

Tested on one of my spinners and one of S_M's, and seems to work fine.

Download Link

Any bugs/opinions appreciated.
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline System32

  • *
  • Posts: 4663
  • Rep: 4
  • Reality
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #305 on: January 06, 2010, 05:37:16 PM »
damn, I must be really bad at coding then.
Put this onto your signature if you were part of this crappy fad in '03.

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #306 on: January 07, 2010, 02:49:34 AM »
Why?
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #307 on: January 07, 2010, 02:56:29 AM »
here is my THZ.py

its the Frenzy Strategy + The robot will move to avoid count out (Frenzy.py doesn't do that)

https://gametechmods.com/uploads/files/THZ.rar

I will put it up on my website shortly

Offline Scrap Daddy

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #308 on: January 07, 2010, 08:17:21 PM »
Lets play a game...Spot the error in the AI lines!



Code: [Select]
    # 42 - Dark Factory of Mass Production "We don't have a motto yet"
    list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("Blind Destruction","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("Abyssal Designator","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("AW-The Prodigy","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
    list.append(("BW-Byter","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
    list.append(("Evil Intent","FBS_1",{'PreSpinEntrance':5,'SpinDirection':1,'ReMobilizeRoutineTime':20,'nose':math.pi*2,'radius':0.3,'range':99,'topspeed':100,'throttle':130,'turn':90,'turnspeed':4,'weapons':(22,23,24)}))


I can't find it and it might not be something wrong with the AI. It doesn't crash like it usually does when there is an AI mistake. It stops loading when the screen gets to 3/4 of the bar on the loading screen of NAR AI. I can't even get out of it either, I have to restart my computer.

Offline Madiaba

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #309 on: January 07, 2010, 11:25:53 PM »
SD, if you can't visually find the prob:

1. Use the syntax checker in Python.

2. Cancel (number sign '#') out all, but only one of the lines. Then, try to load that bot. 
Then un-cancel 1 line at a time, and start each time to find the bad line.
 
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Sage

  • *
  • Posts: 6179
  • Rep: 11
  • RA2 Wizard & GTM's Favorite Stock Builder 2015
  • Awards Sage's Favorite BOTM Winner
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #310 on: January 07, 2010, 11:26:45 PM »
or cancel them all out to see if that's actually the problem.
You got my vote for RA2 Wizard. Always and forever.

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #311 on: January 08, 2010, 06:04:18 AM »
I was trying to make tractor compatable with a srimech, but there's something wrong, and I can't see it.

Code: [Select]
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class Tractorright(AI.SuperAI):
    "Spins in plow style with srimech"
    # - Works just like Spinner.py but with plow and srimech incoroporated into it.
    # - Correct weapon ID numbers will help.
    # - No extra stuff needed in the bindings.
    name = "Tractorright"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
       
        self.spin_range = 3.0
    self.trigger2 = ["Srimech"]       
       
        if 'range' in args:
            self.spin_range = args.get('range')

        self.tactics.append(Tactics.Engage(self))

    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        if self.weapons:
            # spin up depending on enemy's range
            enemy, range = self.GetNearestEnemy()
           
            if enemy is not None and range < self.spin_range:
                self.Input("Spin", 0, 1)
            elif self.GetInputStatus("Spin", 0) != 0:
                self.Input("Spin", 0, 0)
           
        return AI.SuperAI.Tick(self)

    def RobotInRange(self, robot_id):
        "Return tuple of (part-of-robot-in-range, chassis-in-range)"
        # GetLastDamage returns:  component damaged, amount, at time, by player, by component
        range = self.GetDistanceToID(robot_id)
        if range < self.spin_range:
            damage = self.GetLastDamageReceived()
            if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
                return (True, True)
               
        return (False, False)
       
    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0       
       
    def LostComponent(self, id):
        #print "Lost Component!"
        return AI.SuperAI.LostComponent(self, id)

    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)

    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)
           
    def Disable(self,btarget):
        # Disables opponent by charging it at an angle
        # we use a different angle (depending on the size of the opponent!)
        # if target is equal in size, the plow weapon charges are more direct

        if btarget > self: self.Turn(79)
        else: self.Turn(-79)
        if btarget < self: self.Turn(35)
        else: self.Turn(-35)
        if btarget == self: self.Turn(90)
        else: self.Turn(-90)
        if self.target: self.Turn(360)
       
        return AI.SuperAI.Disable(self, btarget)
   
AI.register(Tractorright)
I think the proble is with the line defining the trigger or this bit
Quote
    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0     

Edit: I've given up for the time being as it isn't working.
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #312 on: January 08, 2010, 08:43:26 AM »
what are you getting the robot not preforming the srimech or something else ?

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #313 on: January 08, 2010, 08:44:13 AM »
Game crashing as I try to start battle
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #314 on: January 08, 2010, 08:59:08 AM »
and you have narrowed down the issue to that section ?

Online Pwnator

  • *
  • Posts: 6676
  • Rep: 15
  • Awards BOTM Winner
    • View Profile
    • http://pwnator.tumblr.com
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #315 on: January 08, 2010, 09:13:01 AM »
Lets play a game...Spot the error in the AI lines!



Code: [Select]
    # 42 - Dark Factory of Mass Production "We don't have a motto yet"
    list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("Blind Destruction","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("Abyssal Designator","Kheper",{'nose':math.pi*2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))
    list.append(("AW-The Prodigy","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
    list.append(("BW-Byter","Omni",{'nose':math.pi*2,'invertible':True,'radius':0.1,'topspeed':100,'throttle':130,'turn':60,'turnspeed':2.5,'weapons':(12,13)}))
    list.append(("Evil Intent","FBS_1",{'PreSpinEntrance':5,'SpinDirection':1,'ReMobilizeRoutineTime':20,'nose':math.pi*2,'radius':0.3,'range':99,'topspeed':100,'throttle':130,'turn':90,'turnspeed':4,'weapons':(22,23,24)}))


I can't find it and it might not be something wrong with the AI. It doesn't crash like it usually does when there is an AI mistake. It stops loading when the screen gets to 3/4 of the bar on the loading screen of NAR AI. I can't even get out of it either, I have to restart my computer.


Try opening it using Notepad++ and check if your bindings have these:



This has happened to me on various occasions. What I do is just backspace the automatic indent before list.append and type space one by one until it's indented properly. :D
Clash Cubes 1 - Grey Matter (Runner-Up)
King of Karnage - Sideshow Freak (Runner-Up, Best Engineered)
Rust In Pieces - Paper Cut 3 (Grand Champion, Most Dangerous Bot)
Wheely Tag Tournament - Ion Thruster (Grand Champion, along with Ounces' DiSemboweLment)
UK vs USA - Dark Striker (Grand Champion)
Rust In Pieces 2 - Claymore (Runner-Up, Favourite Bot)
BBEANS 6 - Infection 4 (Runner-Up)
RA2 Team Championships - Serious Business, Skeksis (Runner-Up, along with Scrappy, S_M, and Badnik)
RA2 Team Championships 2 - The Other Stig (Runner-Up, along with Scrappy, S_M, Badnik, 090901, and R1885)
Replica Wars 3 - Abaddon (Runner-Up, Luckiest Bot)
BroBots - wheebot & yaybot (Runner-Up)
Robo Zone 2 - Dipper (4th place, Survival Champion, & Best Axle Bot)
ARBBC - The Covenant (3rd place, BW Rumble Winner, Most Feared BW)

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #316 on: January 08, 2010, 03:00:06 PM »
I was trying to make tractor compatable with a srimech, but there's something wrong, and I can't see it.

Code: [Select]
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class Tractorright(AI.SuperAI):
    "Spins in plow style with srimech"
    # - Works just like Spinner.py but with plow and srimech incoroporated into it.
    # - Correct weapon ID numbers will help.
    # - No extra stuff needed in the bindings.
    name = "Tractorright"

    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
       
        self.spin_range = 3.0
        self.trigger2 = ["Srimech"]        #There's your problem right there; this line needs to be indented once more.
       
        if 'range' in args:
            self.spin_range = args.get('range')

        self.tactics.append(Tactics.Engage(self))

    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        if self.weapons:
            # spin up depending on enemy's range
            enemy, range = self.GetNearestEnemy()
           
            if enemy is not None and range < self.spin_range:
                self.Input("Spin", 0, 1)
            elif self.GetInputStatus("Spin", 0) != 0:
                self.Input("Spin", 0, 0)
           
        return AI.SuperAI.Tick(self)

    def RobotInRange(self, robot_id):
        "Return tuple of (part-of-robot-in-range, chassis-in-range)"
        # GetLastDamage returns:  component damaged, amount, at time, by player, by component
        range = self.GetDistanceToID(robot_id)
        if range < self.spin_range:
            damage = self.GetLastDamageReceived()
            if damage[3] == robot_id and (plus.getTimeElapsed() - damage[2] < 1.0):
                return (True, True)
               
        return (False, False)
       
    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0       
       
    def LostComponent(self, id):
        #print "Lost Component!"
        return AI.SuperAI.LostComponent(self, id)

    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)

    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)
           
    def Disable(self,btarget):
        # Disables opponent by charging it at an angle
        # we use a different angle (depending on the size of the opponent!)
        # if target is equal in size, the plow weapon charges are more direct

        if btarget > self: self.Turn(79)
        else: self.Turn(-79)
        if btarget < self: self.Turn(35)
        else: self.Turn(-35)
        if btarget == self: self.Turn(90)
        else: self.Turn(-90)
        if self.target: self.Turn(360)
       
        return AI.SuperAI.Disable(self, btarget)
   
AI.register(Tractorright)
I think the proble is with the line defining the trigger or this bit
Quote
    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0     

Edit: I've given up for the time being as it isn't working.


Fixed.  The line defining trigger2 needs to be indented more.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #317 on: January 08, 2010, 03:37:59 PM »
space or tab?
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #318 on: January 08, 2010, 05:40:25 PM »
Indents in Python are always four spaces.  Just copy what I did in my post.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings

Offline S.T.C.

  • *
  • Posts: 2105
  • Rep: 4
  • Not to be confused with STDs.
    • www.youtube.com/user/Shad
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #319 on: January 08, 2010, 08:57:53 PM »
I don't know if I should post this here but

my SHW (which is in my showcase) keeps turning while moving forward and back and I can't seem to make it stop doing that.How do you make it so it won't keep doing that?