Summon a mob on play at certain level - minecraft

I have a Redstone timer to activate a command block. I've tried summon vindicator #p[l>9] but it doesn't work. I want to summon a vindicator at the player that's level 10 or higher within a 500 block radius but I have no idea how to do this. This is on Bedrock Edition.

I am Bedrock as well.
Are you creating an arena? Get the coords on the other side from where you are. For example, if you created a 15-block arena, and you're on, let's say... 13 64 0, you would spawn the Vindicator at the other side, -13 64 0. Use either one of these./execute #p[scores:{level = 10}] ~~~ summon vindicator -13 64 0
/testfor #p[x=0,y=64,z=0,r=20,scores;{level = 10}] with a redstone comparator on any direction, a redstone repeater and a normal command block that says /summon vindicator -13 64 0. I hope you find this helpful.

Related

why 0x40010800 + 0x0C equals 0x40010830?

I tried to access RCC_APB2ENR register as a first step to blink green led on stm32nucleo f103rb
then I added 0x0C to 0x40010800(RCC base address).
The expected result was 0x4001080C but the actual result was 0x40010830!!!
It seems 0x0C was left shifted twice but I can't understand why this thing happened.
And even in Ubuntu, the same thing happened.
please let me know
board : stm32 nucleo f103rb
IDE : uVision 5
RCC_BASE points to unsigned int. On your platform size of this type is 4 bytes.
While adding or subtraction to pointers you are increasing (or decreasing) address by operand multiplied by size of element.
For details looks Pointer Arithmetic

Minecraft: summon an item that can't be picked/grabbed by hoppers

I used the following command to summon items around a player for aesthetic purposes. (Minecraft: 1.16.5)
execute as #e[name=Counting,type=minecraft:armor_stand,scores={Count=1}] run execute at
#a[name=Name,gamemode=creative] run summon item ~0.75 ~1 ~-0.75 {Item:
{id:"barrier",Count:1},PickupDelay:20,Age:5985}
I used 4 repeating command blocks to summon 4 different items around the player. Using a dummy scoreboard to determine when to summon each item. The items can't be picked up and last for just a second, but hoppers and hopper minecarts can still pick them up. So if someone with this effect would like to have diamonds or something hard to get, they would just need to stand on top of a hopper to gather the dropped items.
I tried to find a way to summon items that weren't able to get picked/grabbed by hoppers but couldn't find any so I post a question here.
There are 2 ways I can think of
1: Summon an invisible armorstand with the item as a passenger. This might cause hoppers to not pick it up (havent tested), just remember to kill the armorstand and item when removing them.
2: Summon an invisible armorstand with the item on its head. Hoppers/minecarts cannot pick it up, but it will not rotate and bob. This is the easier method, but it wont look like an actual item. If you wanted, you could have the armorstands tp #s ~ ~ ~ ~1 ~ to make them rotate.

how can i use wexitstatus to get the value more than 255

I can just speak a little English so I hope you can understand what I said.
I fork a child process , then I do ADD in child process. EX: 56+48=104
If the value lower than 255 , I can use "wexitstatus(status)" to get the answer.
But if the value higher than 256, it would be wrong !
How can I do?
If the program returns an exit code > 255, the program is simply wrong and needs to be fixed. That's against Unix standard. If you're not using standard Unix, you're probably going to need specialist help from within your organisation contacts.
From manpage for wait():
WEXITSTATUS(stat_val)
If the value of WIFEXITED(stat_val) is non-zero, this macro evaluates to the low-order 8 bits of the status argument that the child process passed to _exit() or exit(), or the value the child process returned from main().
It's limited to 8-bits, which means 1 byte, which means the int from WEXITSTATUS can only range from 0-255. In fact, any Unix program will only ever return a max of 255.
Additionally, many OS's/programs reserve > 127 for system designated codes, so you shouldn't even use anything above that.
If you need more return codes than 126 (since 0 is no error), consider writing it to STDOUT and hooking that.

Output Values in the Ultrasonic Sensor for the Lego NXT

I am trying to read ultrasonic sensor reading from an Lego NXT robot using the programming language NBC (Next Byte Code). It says on the Lego Website that the sensor readings range from 0 -255 cm but when I output the sensor data, I get values above 255 sometimes; this usually happens when my Sensor reads in a value of 255; then after that it reads around 170 - 900 I don't know why it is doing this. Here is my code: (I am first reading in the sensor data then have the robot turn 45 degrees and repeat indefinitely just to examine how the data is being read.)
#include "NXTDefs.h"
// have the robot stay still and keep track of all the distances when turning around.
dseg segment
Distance udword 0
dseg ends
thread main
SetSensorUltrasonic(IN_4)
Forever:
ReadSensorUS(IN_4,Distance)
NumOut(0,10,Distance)
wait 1000
RotateMotor(OUT_B,100,180)
ClearSensor(IN_4)
ResetSensor(IN_4)
set Distance,0
jmp Forever
exit
endt
Well a table makes it perhaps clearer and stays:
Value of "Distance" Display
_ 255 255
_ 80 805
You see the 5 from the previous 255!
As #Charbonier said, you are not clearing the display. In this way, only some of the numbers are written over, creating the illusion that your sensor has gone crazy.
Try using this instead of NumOut() (DRAW_OPT_CLEAR_SCREEN is a constant defined as 1):
NumOutEx(0, 10, Distance, DRAW_OPT_CLEAR_SCREEN)
Alternatively, you may place the following line of code before your NumOut():
ClearScreen()
Are reading the numbers from the display? Are these the values the sensor has read?
For example,
Value of Distance Display
255 255
80 805
You see 805 because, you print 80 on the display and the last 5 from 255 stays still there.
The display is not erased by NumOut(). There should be an option to erase the display, I suppose.

Control a robotic arm

I have a Cyber Robot CYBER 310 and a Sciento CS-113 robotic arm with no documentation. Both use a parallel port.
How could I program those?
For the Cyber one, I found this:
Nothing at all on the Sciento one.
Any pointers or examples in Python/Java/C/whatever appreciated.
[update] This page contains some information, but I'm still lost: http://www.anf.nildram.co.uk/beebcontrol/arms/cyber/software.html
I am not entirely sure I understand what the question is.
Are you unfamiliar with with programming the parallel port?
My memory on it is hazy, but iirc it's pretty simple. It's a "dumb" interface so you simply need to write to it.
If you are running under linux then there are some great resources on it:
Linux Device Drivers: Chapter 9: An Overview of the Parallel port - Talks a bit about parallel port programming and goes on to talk about writing device drivers for it. A bit overkill I think for your application, but the entire book is fascinating, and enlightening.
Linux I/O port programming - essentially you can write to /dev/port, or include asm/io.h and use inb() and outb() (I haven't done this in a while, but im sure if you run into a specific problem there will be a multitude of answers out there once you have it narrowed down to something specific)
If you are on windows or mac, then id still suggest reading the above so you know what you are trying to do, they are straightforward in my opinion, then search for the windows/mac equivalent.
Now for what I assume the crux of the question is, what do you write to the ports?
For the Cyber 310 you have the pin layouts, although there seems to be multiple different pin layouts if you browse the site you have listed, and if we follow anf.nildram.co.uk here we can find some PIC assembly that will show us how to rotate the base.
I have never touched PIC assembly before today, but with some help from the internet and the comments, I think we can translate what this is trying to do (snipped out the relevant portion, as most of it is timing and looping )
; 6: Symbol prf = PORTA.0
; The address of 'prf' is 0x5,0
; 7: Symbol strobe = PORTA.1
; The address of 'strobe' is 0x5,1
; 8: Symbol base = PORTB.0
; The address of 'base' is 0x6,0
; 9: Symbol shoulder = PORTB.1
; The address of 'shoulder' is 0x6,1
...
; 16: main:
L0001:
; 17: base = 1
BSF 0x06,0 // set bit 0 at 0x06 to 1 essentially set base bit to 1
; 18: strobe = 1
BSF 0x05,1 // set strobe bit to 1
; 19: strobe = 0
BCF 0x05,1 // set strobe bit to 0
; 20: While a <> 730 // now we loop 729 more times
So it appears, from my naive perspective, that to rotate the arm you need to set the motor bits (grabbed from your pinout) then set and clear strobe.
Let me know if I am completely off base, this is a fascinating project.
Chris is right about the parallel port being a dumb interface. The parallel port has an address that you can output an 8bit binary number to that match the Digital Output's positions.
I found this to be a really good example of programming the Parallel port using C#.
http://www.codeproject.com/Articles/4981/I-O-Ports-Uncensored-1-Controlling-LEDs-Light-Emit
To match your project to his example. C0 is strobe. Then your Digital Outputs from left to right match his D0-D6.
Seems like a really fun project. Have fun.