コード例 #1
0
#!/usr/bin/env python

import botlib, time

b = botlib.bot("localhost", 'python_doommarine_2')
print "success!  python second doom marine is alive"
print "trying to get my id",
i = b.me()
print "yes..."
print "the python marine id is", i
print "the location of python marine is", b.getpos(i)
for i in range(1, b.maxobj() + 1):
    print "the location of python bot", i, "is", b.getpos(i)
while True:
    for a in range(0, 360, 30):
        b.turn(a)
        time.sleep(3)
    time.sleep(5)
    b.right(100, 100)
    time.sleep(5)
    b.forward(100, 100)
    time.sleep(5)
    b.left(100, 100)
    time.sleep(5)
    b.back(100, 100)
    time.sleep(5)
    b.stepvec(100, 100, 10)
    time.sleep(5)
    b.stepvec(-100, 100, 10)
    time.sleep(5)
    """
コード例 #2
0
#!/usr/bin/env python

import botlib, time, sys

if len(sys.argv) <= 1:
    print "you must invoke this script with an instance id after the script name"
    sys.exit(1)

b = botlib.bot("localhost", "python_demon_hellknight " + sys.argv[1])
print "success!  python is alive"
i = b.me()
print "the python bot id is", i
print "the location of python bot is", b.getpos(i)
for i in range(1, b.maxobj() + 1):
    print "the location of python bot", i, "is", b.getpos(i)
while True:
    for d in range(64):
        print b.step(float(d) / 10.0)
        time.sleep(1)
コード例 #3
0
def botMain(b):
    global me
    print("success!  python doom marine is alive")

    print("trying to get my id...", end=' ')
    me = b.me()
    print("yes")
    print("the python marine id is", me)

    pos = b.getpos(me)
    pen = b.d2pv(pos)
    print("pos = ", pos, "pen coords =", pen)
    ###
    #    an ugly hack to test entity label lookup
    ###
    label_entity_no = b._cache.getEntityNo("label", "the_ammo_loc")
    print("entity number of label =", label_entity_no)
    print("entity position =", b._cache.getEntityPos(label_entity_no))
    ###
    #    end of an ugly hack to test entity label lookup
    ###
    print("finishing now")
    sys.exit(0)


if len(sys.argv) > 1:
    doommarine = int(sys.argv[1])

b = botlib.bot("localhost", "python_doommarine %d" % (doommarine))
execBot(b, False)
コード例 #4
0
#!/usr/bin/env python

import botlib, time

b = botlib.bot("localhost", 'python_demon_hellknight_1')
print "success!  python is alive"
i = b.me()
print "the python bot id is", i
print "the location of python bot is", b.getpos(i)
for i in range(1, b.maxobj() + 1):
    print "the location of python bot", i, "is", b.getpos(i)
while True:
    for d in range(64):
        print b.step(float(d) / 10.0)
        time.sleep(1)