Author Topic: Pre Events  (Read 1566 times)

Can I have multiple OnPlant functions? or should they be OnPlantTwo and OnPlantThree ect
no

why would you need more than one

no

why would you need more than one
To have multiple lines of events.

To have multiple lines of events.
then repeat that part in the onPlant, silly.

then repeat that part in the onPlant, silly.
How would that work?
Like this?
Code: [Select]
function brickCheckpointData::onPlant(%data, %obj)
{
   %obj.enableTouch = true;

   %enabled     = 1;
   %delay       = 0;
   %inputEvent  = "OnPlayerTouch";
   %target      = "Self";
   %outputEvent = "PlaySound";
   %par1        = Beep_Popup_Sound.getId();
   %obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent, %par1);

   %obj.enableTouch = true;

   %enabled     = 1;
   %delay       = 0;
   %inputEvent  = "OnPlayerTouch";
   %target      = "Client";
   %outputEvent = "ChatMessage";
   %par1        = I love pigs!();
   %obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent, %par1);
}

function brickCheckpointData::onLoadPlant(%data, %obj)
{
   Parent::onLoadPlant(%data, %obj);
   %obj.enableTouch = true;
}

Basically, even though there are errors in there.

That would work till %par1        = I love pigs!();
Not that you should have a function in chat message anyways.

That would work till %par1        = I love pigs!();
Not that you should have a function in chat message anyways.
Why would that not work? and why shouldn't I have one?

Well, because that parameter is a string.  You gave it a function, which is basically saying "Ok script, I want you to place the words ok script go do the function I love pigs in the chat box."  That makes no sense.

So, what you do is instead of giving the %par1 a function, give it a string like this:
Code: [Select]
%par1 = "I love pigs!";That should fix your problem.  Hopefully I didn't just make a complete dumbass of myself.

Well, because that parameter is a string.  You gave it a function, which is basically saying "Ok script, I want you to place the words ok script go do the function I love pigs in the chat box."  That makes no sense.

So, what you do is instead of giving the %par1 a function, give it a string like this:
Code: [Select]
%par1 = "I love pigs!";That should fix your problem.  Hopefully I didn't just make a complete dumbass of myself.
You can use a function in there, however, doing something like

%par1 = getRandom(1,5);
It will only do the getRandom the moment you define that variable, so lets say it got 4, and the event was onActivate, it will ALWAYS show 4, no matter how many times you click it.

I love pigs!(); isn't even proper syntax.
You would either do Ilovepigs(); or "I love pigs!";
And if you did the former, you would have to define said function via
function ILovePigs()
{
return some stuff here;
}

I made the coding and everything but it's not showing up in the add on list.

Do you have a description.txt in the zip?


Check the console log for errors or use exec("add-ons/your_folder/server.cs"); to see if there are any errors.