How to check if the core is connected to the network

Started by BilboGCL, December 07, 2017, 01:39:42 PM

Previous topic - Next topic

BilboGCL

Hi,
once again a kind of noobish question, but I really have no idea how I check if the core is connected to the network or how to specify how much power it consumes.

I'm looking for medium to high power support core (it has to do heavy work, so it should need a pile of energy)...
Any help is welcome!

Greetings from The Shire!

Edit: In addition, I don't really get the ammo-request, too...
Hey, come to the dark side Discord, we have cookies!

BilboGCL

OK - I figuered at least the ammo-request:

once
Self CONST_REQUESTPACKETS 1 SetUnitAttribute
Self CONST_CANREQUESTAMMO 1 SetUnitAttribute
Self CONST_PACKETREQUESTDELAY 30 SetUnitAttribute
endonce

Self CONST_AMMO GetUnitAttribute ->ammo
1 <-ammo lt  if
Self CONST_AMMO <-ammo 1 sub SetUnitAttribute
        # do something
endif
Hey, come to the dark side Discord, we have cookies!

GoodMorning

There is no good way to check for a network connection. The best workaround is to see if you can request a packet.

It's also easier to put a CONST_CONNECTABLE line in the once block than shave to set it for every Core.

At the moment, your Core is asking for energy at half the rate that building something does (without the Forge). This will give you an estimate for a good packet interval.
A narrative is a lightly-marked path to another reality.

BilboGCL

Hm, and /how/ do I check for the ability to request a packet?...

And yes, at that time it was rather slow, I changed the CONST_PACKETREQUESTDELAY to 10 (but decided to paint digitalis instead of testing...)

And the once block, that's some kind of mystery to me - I've set all these values in the editors menu of the core, but the script rejected to work until I've duplicated the information in the once block.

Greetings from The Shire!
Hey, come to the dark side Discord, we have cookies!

GoodMorning

Here's an example of something which will request packets.


once
#The unit is...
Self CONST_CONNECTABLE 1 SetUnitAttribute
Self CONST_REQUESTPACKETS 1 SetUnitAttribute

#(There will be somethinn about ISBUILDING here later.)
#Self CONST_CANREQUESTAMMO 0 SetUnitAttribute
Self CONST_CANREQUESTAMMO 1 SetUnitAttribute

#And is not...
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_COUNTSFORVICTORY 0 SetUnitAttribute

#And has...
Self CONST_MAXAMMO <-MaxEnergy SetUnitAttribute
Self CONST_AMMO 0 SetUnitAttribute
Self CONST_PACKETREQUESTDELAY 0 SetUnitAttribute
endonce


About "once": It executes exactly once. If the code reaches the "once" a second time, it jumps straight to the "endonce".

Does that make some kind of sense?
A narrative is a lightly-marked path to another reality.

WithersChat

Same problem, same lack of solution. I imagined using a message artifact, for a custom thing you're supposed to collect.
There is no signature!

Grabz

There simply isn't a feasible solution.

You can monitor whether your core is receiving ammo and assume it is connected to a network if so. There is no real other way to tell. I've seen people talk about checking whether there are collectors/relays in range, but IMO it's not a reliable solution (they can be deactivated and we can't tell), nor is it fast (PZ relay range is enormous).

If your goal is to just have a collectible CRPL core, just track its ammo count and perform an action at full ammo.

GoodMorning

Alternatively, create a message artifact under your collectible. It won't work for Guppies, though.
A narrative is a lightly-marked path to another reality.