Author Topic: Add my own options to setRandomAppearance  (Read 975 times)

How do I add my own options to setRandomAppearance without re-registering it?
« Last Edit: March 17, 2013, 04:28:58 PM by Electrk »

You have to overwrite the function anyways if you want it to use more paramters?
what

I rephrased the OP and title
« Last Edit: March 17, 2013, 04:37:29 PM by Electrk »

I'm not sure what arguments that function takes, but you can toss it into a package and go from there.

I'm not sure what arguments that function takes, but you can toss it into a package and go from there.

I want to add it to the event list

onBotSpawn > Bot > SetRandomAppearance > City
                                                               Space

I want there to be a third one.

I want to add it to the event list

onBotSpawn > Bot > SetRandomAppearance > City
                                                               Space

I want there to be a third one.

Oh it's an event. If you take a look at the code that handles these events, there should be a few examples of how to add your own appearances into it.

registerOutputEvent(Bot, "SetRandomAppearance", "List City 0 Space 1",0 );

there doesn't appear to be a way...

registerOutputEvent(Bot, "SetRandomAppearance", "List City 0 Space 1",0 );

there doesn't appear to be a way...
Assuming registerOutputEvent stores everything in some sort of output event array, couldn't you find the array value corresponding to setRandomAppearance, get the string holding the appearance list (just in case someone else made a mod like yours as well) and append your changes to the end of the string?

Assuming registerOutputEvent stores everything in some sort of output event array, couldn't you find the array value corresponding to setRandomAppearance, get the string holding the appearance list (just in case someone else made a mod like yours as well) and append your changes to the end of the string?
no  because that's not how it works -  that's string  value,  not string  number-in-list
registerOutputEvent(Bot, "SetRandomAppearance", "List City 0 Space 1",0 );

there doesn't appear to be a way...
try calling that function again

Why can't you re-register the event? If you do it at start up, no one will be in the server and the new clients that connect will get the new registered data.
You could call:
registerOutputEvent(Bot, "SetRandomAppearance", "List City 0 Space 1 Enemy 2",0 );

Then package:
function AiPlayer::SetRandomAppearance(%this,%type,%client)
{
    if(%type < 2)
       return Parent::SetRandomAppearance(%this,%type,%client);
    //Do stuff here

}

But I don't want it to conflict with other add-ons that do the same thing.

Look in the duplicator code, you can retrieve the previously registered information and add on to it, which seems like to much work for what it does....
what other add-ons overwrite it?

I mean in the future.

I'll check out the duplicator's code

I'm not sure how to retrieve it. I checked the duplicator's code and I couldn't figure it out.

I think he meant to say JVS.