How to check if the core is connected to the network

BilboGCL · 2926

BilboGCL

  • Community Guild
  • *****
    • Posts: 481
How to check if the core is connected to the network
on: December 07, 2017, 01:39:42 pm
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...
« Last Edit: December 07, 2017, 04:23:08 pm by BilboGCL »

Hey, come to the dark side Discord, we have cookies!


BilboGCL

  • Community Guild
  • *****
    • Posts: 481
Re: How to check if the core is connected to the network
Reply #1 on: December 07, 2017, 04:52:43 pm
OK - I figuered at least the ammo-request:
Code: [Select]
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

  • Community Guild
  • *****
    • Posts: 3453
  • (Pusillanimous)
Re: How to check if the core is connected to the network
Reply #2 on: December 07, 2017, 07:15:39 pm
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

  • Community Guild
  • *****
    • Posts: 481
Re: How to check if the core is connected to the network
Reply #3 on: December 07, 2017, 08:20:43 pm
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

  • Community Guild
  • *****
    • Posts: 3453
  • (Pusillanimous)
Re: How to check if the core is connected to the network
Reply #4 on: December 07, 2017, 08:39:16 pm
Here's an example of something which will request packets.

Code: [Select]
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

  • Full Member
  • ***
    • Posts: 113
  • There is no personal text!
Re: How to check if the core is connected to the network
Reply #5 on: April 08, 2020, 10:59:09 am
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

  • Community Guild
  • *****
    • Posts: 235
  • Where will you be when the creeper waves hit?
Re: How to check if the core is connected to the network
Reply #6 on: April 10, 2020, 05:07:52 am
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.

For quicker response, reply to me directly at Grabz#4707 on Discord. Find me on the KC server: https://discord.gg/knucklecracker


GoodMorning

  • Community Guild
  • *****
    • Posts: 3453
  • (Pusillanimous)
Re: How to check if the core is connected to the network
Reply #7 on: April 10, 2020, 09:13:00 pm
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.