How to override core command?

How to override core command?

Postby Ultima » 14 Dec 2011, 12:03

How to override a core command? :)

I want to make some changes of my own in some commands but i cant compile them because their core commands
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: How to override core command?

Postby dzienny » 16 Dec 2011, 00:30

There's no clean way to do it, but there is one that should work.

You have to create a custom command that will remove core command from the commands pool.

For example, if you want to remove /alive command do this in the command:
Code: Select all
Command.all.Remove(Command.all.Find("alive"));

After you remove it you can load a custom command that is named CmdAlive2 and it will replace the core command. Still it will work till you reset a server.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: How to override core command?

Postby Ultima » 16 Dec 2011, 12:12

Can it work if i put that remove command in a autoload and after that autoload my custom command?

A whole new world of options opening now :mrgreen:
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: How to override core command?

Postby dzienny » 16 Dec 2011, 13:31

Ultima wrote:Can it work if i put that remove command in a autoload and after that autoload my custom command?

A whole new world of options opening now :mrgreen:


Well the problem is that the software autoloads commands, but it doesn't executes them. So you have to do it manually, and for now, there isn't any nicer way to do it.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: How to override core command?

Postby Ultima » 16 Dec 2011, 13:43

Cant i make a contructor to make the command excecute?

Like:
Code: Select all
public static void Init()
{
        //Delete command here
}
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: How to override core command?

Postby dzienny » 16 Dec 2011, 16:15

Ultima wrote:Cant i make a contructor to make the command excecute?

Like:
Code: Select all
public static void Init()
{
        //Delete command here
}


In the newest release there was a method named Init() added. Thus you can overwrite it. Init() method is called on command loading.

public override void Init()
{
}
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: How to override core command?

Postby Ultima » 16 Dec 2011, 16:26

dzienny wrote:In the newest release there was a method named Init() added. Thus you can overwrite it. Init() method is called on command loading.

public override void Init()
{
}


Nice. Cant wait for its release :mrgreen:
Can finaly make my own heartbeat to my own script with that :roll:
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: How to override core command?

Postby dzienny » 16 Dec 2011, 16:30

Ultima wrote:
dzienny wrote:In the newest release there was a method named Init() added. Thus you can overwrite it. Init() method is called on command loading.

public override void Init()
{
}


Nice. Cant wait for its release :mrgreen:
Can finaly make my own heartbeat to my own script with that :roll:


It's already released (v. 7.2.1). Concerning the heartbeat remember to put the loop in separate thread, or timer.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: How to override core command?

Postby Ultima » 16 Dec 2011, 16:32

dzienny wrote:It's already released (v. 7.2.1).


Can u post somewhere what fixes are included?
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: How to override core command?

Postby dzienny » 16 Dec 2011, 17:00

Ultima wrote:
dzienny wrote:It's already released (v. 7.2.1).


Can u post somewhere what fixes are included?


Yes, all is in changelog that I just updated.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Next

Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 3 guests

cron