CRPL problem

Started by wolkiewicz, June 30, 2014, 01:25:36 PM

Previous topic - Next topic

wolkiewicz

Hi
Could someone help me with that script? It is my 2nd script and i dunno what's wrong :/

once Self CONST_REQUESTPACKETS SetUnitAttribute endonce
once Self CONST_ISBUILDING SetUnitAttribute endonce
once Self CONST_BUILDCOST 20 SetUnitAttribute endonce
if "CONST_BUILDCOST" eq0
SetTechLimit("FIRERANGE" 5)
endif

I can connect crpl core to CN but it don't recive packets.

planetfall

#1
Try this.


once
   Self CONST_CONNECTABLE true SetUnitAttribute
   Self CONST_REQUESTPACKETS true SetUnitAttribute
   Self CONST_ISBUILDING true SetUnitAttribute
   Self CONST_BUILDCOST 20 SetUnitAttribute
endonce
Self CONST_BUILDCOST GetUnitAttribute eq0 if
   SetTechLimit("FIRERANGE" 5)
endif


edit: whoops, I'm losing my touch :/

If that doesn't work try changing the second CONST_BUILDCOST to CONST_ISBUILDING.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Crimson King

First off, you only need one once block to set the attributes. Second, you give no value to the REQUESTPACKETS and ISBUILDING constants. For those constants, 1 is true and 0 is false.

Your if statement doesn't work because the BUILDCOST constant will never equal 0. Try checking against the ISBUILDING constant instead.

Try this:

once
Self CONST_REQUESTPACKETS 1 SetUnitAttribute
Self CONST_ISBUILDING 1 SetUnitAttribute
Self CONST_BUILDCOST 20 SetUnitAttribute
endonce

Self CONST_ISBUILDING ->test
if <-test eq0
SetTechLimit("FIRERANGE" 5)
endif

planetfall

Quote from: Crimson King on June 30, 2014, 02:11:06 PM

Self CONST_ISBUILDING ->test
if <-test eq0
SetTechLimit("FIRERANGE" 5)
endif


it should be
<-test eq0 if
OR
if(<-test eq0)

Also you're missing a GetUnitAttribute.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Crimson King

Oops about missing the GetUnitAttribute. The syntax is wonky in my code because I used the code provided by the OP and only made the necessary changes to get it to work.

wolkiewicz

Thx for help guys! You are the best!