#Export/Import FormData

1 messages · Page 1 of 1 (latest)

dense fable
#

Where line 45?

oblique urchin
#

[index.js] ran with error: [TypeError: Incorrect number of arguments to function. Expected 0, received 1 at ActionFormData (native)
at <anonymous> (@DBE/systems/missions.js:45)
]

dense fable
#

Wait

oblique urchin
dense fable
#

You put function inside ActionFomrData?

oblique urchin
#
import { mission } from "../systems/missions";

dense fable
#
import { ActionFormData } from "@minecraft/server-ui";

export function mission(player) {
    const form = new ActionFormData();
    form.title("ui.missions.title");
    form.button("");
    form.button({ rawtext: [{ translate: "start" }] });
    form.body({
      rawtext: [
        { translate: "mission.title_1" },
        { text: "\n" },
        { translate: "mission.text_1" },
        { text: "\n" },
        { translate: "mission.objective_1" },
      ],
    });
    form.show(player).then((response) => {
      switch (response.selection) {
        case 0:
          if (player.hasTag("dbe:kaioken")) {
            kaioken(player);
          } else if (player.hasTag("dbe:kaioken_x3")) {
            kaioken_x3(player);
          } else if (player.hasTag("dbe:kaioken_x10")) {
            kaioken_x10(player);
          } else if (player.hasTag("dbe:kaioken_x20")) {
            kaioken_x20(player);
          } else
            system.runTimeout(() => {
              menu(player);
            }, 1);
          break;
        case 1:
          player.runCommandAsync(
            'tellraw @initiator[scores={dbe:mission2=1..}] {"rawtext":[{"translate":"mission.error.2"}]}'
          );
          player.runCommandAsync(
            "execute at @s[scores={dbe:mission2=0}] run function sagas/saiyan/mission_1"
          );
          break;
      }
    });
  }
#

Then on another file

import { mission } from "../systems/missions";

// ...
mission(player)
oblique urchin
#

Oka let me test

#

@dense fable

dense fable
#

?

oblique urchin
#

I put the mission(player) in the form data of the ui.js archive and it isn't opening

dense fable
#

Have you import it?

#

What version are you?

oblique urchin
#

The stable 1.19.81

dense fable
#

Did the menu form is open?

oblique urchin
fathom rover
#

why not just use

if (response.selection == 0) {
  [other if statments] {
    [code]
  }
}
#

why do u have to use switch

#

looks cleaner thats all

oblique urchin
#

It's bec i prefer to create the scripts in an organized way in folders

fathom rover
#

is 0 mission button?

oblique urchin
#

It is 1

fathom rover
#

alright

#
import { ActionFormData } from "@minecraft/server-ui";
import { menu } from "./[menu path]"

export function mission(player) {
    const form = new ActionFormData();
    form.title("ui.missions.title");
    form.button("");
    form.button({ rawtext: [{ translate: "start" }] });
    form.body({
      rawtext: [
        { translate: "mission.title_1" },
        { text: "\n" },
        { translate: "mission.text_1" },
        { text: "\n" },
        { translate: "mission.objective_1" },
      ],
    });
    form.show(player).then((response) => {
      switch (response.selection) {
        case 0:
          if (player.hasTag("dbe:kaioken")) {
            kaioken(player);
          } else if (player.hasTag("dbe:kaioken_x3")) {
            kaioken_x3(player);
          } else if (player.hasTag("dbe:kaioken_x10")) {
            kaioken_x10(player);
          } else if (player.hasTag("dbe:kaioken_x20")) {
            kaioken_x20(player);
          } else
            system.runTimeout(() => {
              menu(player);
            }, 1);
          break;
        case 1:
          player.runCommandAsync(
            'tellraw @initiator[scores={dbe:mission2=1..}] {"rawtext":[{"translate":"mission.error.2"}]}'
          );
          player.runCommandAsync(
            "execute at @s[scores={dbe:mission2=0}] run function sagas/saiyan/mission_1"
          );
          break;
      }
    });
  }

that could be it im not sure

#

import { menu } from "./[menu path]"

oblique urchin
#

I found!!!

#

The problem!

#

It is working

#

TY GUYS FOR THE HELP! ❤️

fathom rover
#

what was the problem

oblique urchin
#

@fathom roverbut can u help me with this

#

form.body({
rawtext: [
{ translate: "mission.title_1" },
{ text: "\n" },
{ translate: "mission.text_1" },
{ text: "\n" },
{ translate: "mission.objective_1" },
],
});

fathom rover
#

what about it

oblique urchin
#

The lines are not below of each another

fathom rover
#

also could u test sum for me i cant get on mc rn

fathom rover
oblique urchin
#

{"translate":"mission.title_1\n\n"}

dense fable
#
form.body({
    rawtext: [
      { translate: "mission.title_1" },
      { text: "\\n" },
      { translate: "mission.text_1" },
      { text: "\\n" },
      { translate: "mission.objective_1" },
    ],
  });
oblique urchin
#

oh

dense fable
#

Idk if it's works, but try it

fathom rover
#

why would it be that

#

seems like it would just do n

oblique urchin
fathom rover
#

oh no

#

i mean in the .lang

#

wait thats where it is right?

#

wherever it is

#

do [text]\n

#

and remove { text: "\n" },

oblique urchin
#

hm

fathom rover
#

that should work

oblique urchin
#

@fathom roverLike this??

fathom rover
#

SMH

#

NO

#

lol

#

ight

oblique urchin
#

Xd is what i understand XD

fathom rover
#

-_-

#

remove the [text]\n

#

both of them

oblique urchin
#

form.body({
rawtext: [
{ translate: "mission.title_1" },
{ translate: "mission.text_1" },
{ translate: "mission.objective_1" },
],
});

#

Hmm

fathom rover
#

now where did u make the translate things

#

in en_US.lang?

oblique urchin
#

pt_BR and en_US

#

Both of them

fathom rover
#

k

#

make it have \n at the end of the texts

oblique urchin
#

Ok

#

@fathom rover

fathom rover
#

yep

oblique urchin
#

;-;

fathom rover
#

u dont nee to ping

oblique urchin
#

Oka

oblique urchin
fathom rover
#

test

oblique urchin
#

It is a print in the game xd

#

Don`t worked

fathom rover
#

"didn't work?"

oblique urchin
wheat elm
# oblique urchin
form.body({
    rawtext: [
      { translate: "mission.title_1" },
      { text: "\n" },
      { translate: "mission.text_1" },
      { text: "\n" },
      { translate: "mission.objective_1" },
    ],
  });
#

lmao

karmic ermine
oblique urchin
#

@karmic ermineCan u help me pls

#

How can i test more than one score in getScore??

karmic ermine
#

if(getScore && getScore) testa isso

#

@oblique urchin

#

If score1 is less than 0 and greater than 10 do this: