CraftTweaker

CraftTweaker

151M Downloads

(1.12.2) try to execute command

jesuseduardo90 opened this issue · 7 comments

commented

Issue description

I just cant execute a command i dunno why, try different variation but no luck.

always says "[23:10:16] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] §cERROR: [crafttweaker | SIDE_CLIENT]: Error parsing example.zs:6 -- ; expected"
basicly something is bad programmed y guess any help?

code:

import crafttweaker.world.IWorld

//val serverSender = Commands.getServerCommandSender();
//executeCommand(raw)

server.commandManager.executeCommand("/give @A diamond 64");

Steps to reproduce

No response

Script used

https://gist.github.com/jesuseduardo90/6a263534c668eff2e79f94df165c77af

The crafttweaker.log file

https://gist.github.com/jesuseduardo90/739ff16f6c95961bd4efcec596934a30

Minecraft version

1.12

Modloader

Forge

Modloader version

5.28.60

CraftTweaker version

1.12-4.1.20.674

Other relevant information

No response

The latest.log file

https://gist.github.com/jesuseduardo90/6a263534c668eff2e79f94df165c77af

commented

Oh well srry i didnt put the ";" but still errors mostly im missing stuff, is even possible to make CT use commands? Because placin blocks doesnt define dimension so idunno.

commented

You gave 6 lines, I don't know if you have other lines or what you're trying to do.
1.12 loads scripts before you even get to the main menu, there is no world or a server.

If you want to run a command at a certain point, you need to use events.

Not sure what placing blocks has to do with dimension, if you're talking about the block place event, you should get a world, which should have a worldinfo or similar, which will have access to what dimension it is.

commented

srry im lost cause new programming languaje alot of ideas, stuff:v
ok what i try to do is, to execute a command when a player enters a dimension for now, i plan just for the first time a players enters a dimension but ill se that later.
This is the code y have manage but no luck.(also this means cheats need to be available for all or just admin?)

import mods.ctutils.commands.Commands;
val serverSender = Commands.getServerCommandSender();
server.commandManager.executeCommand(serverSender, "/give @A minecraft:magma 64");

i also try this one for the dimension but also no luck.(an old version but something like that)
import crafttweaker.world.IWorld;
import crafttweaker.player.IPlayer;
import crafttweaker.player.IUser;
import crafttweaker.entity.IEntityLivingBase;

if(Iplayer.data.getDimension()==1) {
print("hello");
}

commented

If you need script help, I'm going to ask you to join the discord.
https://discord.blamejared.com

You will get help much faster than via github.

commented

Ok tks bro:v

commented

Just to clarify is just an issue.
My goal is to when i teleport first time to the end i wanna /setblock

commented

The issue is that your first line is missing a ; at the end, it should read:

import crafttweaker.world.IWorld;