Author Topic: A stupid question regarding fetching the Category name  (Read 1987 times)

Here is a better method to get the host's ID, since this works on LAN servers as well.

Code: [Select]
function getBlocklandID()
{
if($Server::LAN)
return 999999;
else
return getNumKeyID();
}

Because all LAN BL_IDs are 999999 for some reason. :v

Because all LAN BL_IDs are 999999 for some reason. :v

No, don't go and change the code that I posted.

Code: [Select]
function getBlocklandID()
{
if($Server::LAN)
return getLAN_BLID();
else
return getNumKeyID();
}

getLAN_BLID() is a default function and is the proper way to do it, in case Badspot ever changes the LAN ID from 999999.

I think now comes the moment of truth; something that has been bothering me since Day 1 of this programming project.


Some of the custom bricks in this add-on use "trigger" datablocks. (aka you walk on them and they activate) I've been having a problem where when you load these bricks, they do not load their respective triggers. This is a problem also seen in the dead CityRPG mode, but now Im having this issue too.

Is there any hope of fixing this?

Yes, you can package the plant function for a specific brick datablock and have it create the trigger.

Package onloadplant not onplant.

For clarification:

OnLoadPlant - when a brick is loaded only
OnPlant - when a brick is manually planted only
OnAdd - both of the above

I would recommend either the first or the third

For clarification:

OnLoadPlant - when a brick is loaded only
OnPlant - when a brick is manually planted only
OnAdd - both of the above

I would recommend either the first or the third
Yes onadd is the one I was talking about

No, don't go and change the code that I posted.

Code: [Select]
function getBlocklandID()
{
if($Server::LAN)
return getLAN_BLID();
else
return getNumKeyID();
}

getLAN_BLID() is a default function and is the proper way to do it, in case Badspot ever changes the LAN ID from 999999.

I just check if the ID is 999999 so it can safely assume Badspot hasnt changed all LAN IDs being the same, then an else if which does what I require.

This way I dont need to update my code.

Code: [Select]
%host = getNumKeyID();
if(%host = 999999)
 {
  echo("Halting because Badspot wont fix all LAN IDs being 999999. Poopie.");
  return;
 }
else if([list of IDs here, cut out for security reasons])
 {
  echo("Authorization Detected. Booting.");
  exec("./boot.cs");
 }
else
 {
  warn("Security blacklist prevents unauthorized blockland players from booting this addon! WILL NOT BOOT!");
  return;
 }




Anyways, here was my current attempt to fix this.

Code: [Select]
package plantLots
{
        function LOLPLACEHOLDERSmallLotBrickData::OnAdd(%this,%brick,%a)
        {
    echo("Debug: ", "Hey I know this works!");
%brick.getDatablock().triggerDatablock = LOLPLACEHOLDERLotTriggerData;
%brick.getDatablock().LOLPLACEHOLDERBrickType = 1;
%brick.getDatablock().trigger = 0;
             parent::OnAdd(%this,%brick,%a);
        }
};

But I can see now this didnt work because Im not good at this sort of thing. I probably screwed up lots.

Maybe I can just get someone over IRC to help me out with this bug... be warned, its supposed to be a private oriented mod with good reasons.
« Last Edit: June 03, 2012, 10:59:17 PM by Randomness »