Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

[HELP] How can i put timer on this ?

Open metinxd opened this issue 3 years ago • 3 comments

Prerequisites

Console Client Version

1.18.1

Describe your problem

//MCCScript 1.0 MCC.LoadBot(new UseItem());

//MCCScript Extensions public class UseItem : ChatBot { private bool enabled = false; public override void Initialize() { RegisterChatBotCommand("auto", "UseItem repeatly", "start, stop", CommandHandler); LogToConsole("Loaded"); }

public string CommandHandler(string cmd, string[] args)
{
    if (args.Length >= 1)
    {
        switch (args[0])
        {
            case "start": enabled = true; break;
	case "stop": enabled = false; break;
        }
        return "Switched to " + args[0];
    }
    else
    {
        return "Current: " + (enabled ? "running" : "stopped") + ". Use /auto start|stop to switch";
    }
}

public override void Update()
{
    if (enabled)
        UseItemInHand();
}

}

Suggest a possible solution

No response

Attach screenshot here (If applicable)

No response

Minecraft Version

No response

Device

No response

Operating System

Windows

metinxd avatar Jan 31 '22 18:01 metinxd

Given what your script does, you can just setup ScriptScheduler and create a task with action=useitem with the desired time interval, instead of writing a C# bot.

ORelio avatar Jan 31 '22 19:01 ORelio

Given what your script does, you can just setup ScriptScheduler and create a task with action=useitem with the desired time interval, instead of writing a C# bot.

timeInterval=0 its means 0 sec but doesnt go fast its like 1 click per sec can i get faster than this ?

metinxd avatar Jan 31 '22 21:01 metinxd

ScriptScheduler interval is expressed in seconds so the minimum value is indeed 1 second. You can do useitem several times each second by using an external script (so it will do it several times then wait 1 second):

useitem.txt

useitem
useitem
useitem

tasks.ini

[Task]
triggerOnInterval=true
timeInterval=1
action=script useitem.txt

ORelio avatar Feb 01 '22 18:02 ORelio