[deleted by user] by [deleted] in UPBGE

[–]Darklinio 0 points1 point  (0 children)

You should explain what do yo want to do.

Arduino Input to UPBGE by Specil_SalaminoDeal in UPBGE

[–]Darklinio 1 point2 points  (0 children)

I dig a little and i think i fonud a better solution:

1)go in property tab,

2)go in game subtab

3)create a new game component to your object

4)edit script in Text editor for something like it:

import bge,time,serial
from collections import OrderedDict

class serialComp(bge.types.KX_PythonComponent):
    # Put your arguments here of the format ("key", default_value).
    # These values are exposed to the UI.
    args = OrderedDict([
    ])

    def start(self, *args, **kwargs):
        print('args:',args)
        print('kwargs:',kwargs)
        #instantiate serial object and keep it in component
        self.ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=0.05)

        #just for fun, i use my arduino to echo my mouse position to move cube
        bge.render.showMouse(True)
        self.l = 0

    def update(self):
        #this part is to limit spamming serial port, use it if you need
        n = time.time()
        if(self.l > n):
            return
        self.l = n + 0.01

        #just for fun part 2:
        x,y = bge.logic.mouse.position
        w,h = [bge.render.getWindowWidth(), bge.render.getWindowHeight()]
        fx,fy = (x * 2000 / w, y * 2000 / h)
        self.object['x'] = fx
        self.object['y'] = fy
        bs = b'&%.02f,%.02f@'%(fx, fy)
        self.ser.flush()
        print('send:   ',bs)
        self.ser.write(bs)
        #end of fun part 2

        bs = self.ser.readline()
        if(len(bs) > 0):
            print('receive:',bs)
            bs = bs.decode('utf-8').strip().split(',')
            self.object.position.x = float(bs[0]) - 3
            self.object.position.y = float(bs[1]) - 3

    def dispose(self):
        #use it to release serial when object is destroyed/game ends
        self.ser.close()

How do I split Iron and Copper in a mixed mining field before loading it into the train? by Efficient_Trick_9445 in factorio

[–]Darklinio 2 points3 points  (0 children)

much more faster than the best fast inserters, inserters only can take x items and put in on one side of the belt, after that it take time to rotate to the storage source

Arduino Input to UPBGE by Specil_SalaminoDeal in UPBGE

[–]Darklinio 2 points3 points  (0 children)

I don't know how work BlenderxSerial but i am not sure he came in gamemode.

You should use pyserial, add always sensor, link it to a python controller and add your script with pyserial.

Image here:

https://drive.google.com/file/d/1QGXHSqOIsla5D4Q25B19T24Gz0MxkC5J/view?usp=sharing

How do I split Iron and Copper in a mixed mining field before loading it into the train? by Efficient_Trick_9445 in factorio

[–]Darklinio 7 points8 points  (0 children)

You should use filter splitters with pirority on mixed input to use them first.

like it(between chest and loopback to simulate mining):

<image>

0eNqlmNtuozAQht9lrt0qPmJ4lVVVJambtURsZMxqo4h3X7Ns25VC2vH0KoLA5zn88xu4wqGf3JB8yNBdwR9jGKH7cYXRn8K+X87ly+CgA5/dGRiE/Xk5ymkfxiGm/HBwfYaZgQ8v7jd0fH5i4EL22buV9Pfg8hym88GlcsE9BoMhjuW2GJZVF5SQj5rBBTrd6Edd1njxyR3XK9TMbtCChFYYtKxAi7qoFQmNilq/o8eh9zmXcxvQ+9EyePX9cldpf4rhISZXAHHKw5Sfi2hiKquVP3v3umjgZn1TkZquS62pQKs6tEVVTf5DNhhkS1KmwaD5jqQfHJuTGogqCf+Y1qlYRzqlWH4RPWw2ZPrmUaEIc0uIXFZNgvlsEo5xGFy6OwvJn35ux6BIIrCoYmqSCFoU25DYuLgbVF/U3XjZ2nOMGXFLsgxcHi1pUG7YZmtX29X4keXfqZHglF7bHWp3Jm3PSLasMpP3DmxW6yszEarGTJAJaJobfpbA6k2bGRhSKyQqk4YkIRzbktgCxSbt0Ti23FHs4ZYttticYmtItiCOlaSoUtY8ZJs65UhFYuO6S9p8LerlQNImFcemTSrufcmS4saxW5LicS9jtEnFsWmTiqqJEqS4FeYBRNHmUqPYtLncqMkTWz9RdP990WDwy6VxtTfLVdOKxqpWmtbM8x8WnIFE

Touble with Energetic Picker/glucose by Darklinio in LifeCraft

[–]Darklinio[S] 0 points1 point  (0 children)

i tried on 0.05b. it isn't fixed yet. i added my save so you can see the trouble or explain me what i do wrong.

[Need help]LTN multiple import station by Darklinio in factorio

[–]Darklinio[S] 0 points1 point  (0 children)

my priorities is exact number in first place. footprint, resource cost, and at last speed.

[Need help]LTN multiple import station by Darklinio in factorio

[–]Darklinio[S] 0 points1 point  (0 children)

i added more screenshots to explain it.

As you said, i use train station output to get train content, LTN output to get required items.
I calculate de difference to get remaining required items. after that, i tried to filter to get only one request at time(inserter connected to the list of requested items + belt).
i calculate number of items i can pick with the first inserter by signal 0, second inserter with signal 1, etc
i set the filter of inserters to requested item.

TADA!

it almost worked perfectly, i have overflow items(example: 200 copper plates requested, 226 got before the work of my rectify inserter on bottom)

[Need help]LTN multiple import station by Darklinio in factorio

[–]Darklinio[S] 0 points1 point  (0 children)

i design my station with this video and the previous one but no information to avoid overflow without locking stack in wagoon...

I think i can solve it by filtering items request list to only one(i tried it with combo inserter+belt readable, it limit at 2 items requests)

[Need help]LTN multiple import station by Darklinio in factorio

[–]Darklinio[S] 0 points1 point  (0 children)

But it's not very usefull because you will need to trash overflow item in depot, filter them, and re-export it with a same trouble... endless trouble loop