Jump to content
  • 0

Help Needed: Script Error with atcommand


Question

Posted

I am encountering a script error while trying to use the atcommand function in my summon_monsters.txt script. The script is intended to summon monsters using a custom command. However, I receive the following error after reloading the script:
 

function script summon_monsters {
    .@mob_id = getarg(0);
    .@qty = getarg(1);

    if (.@mob_id > 0 && .@qty > 0) {
        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));
    }
}

and error after reload

script error on npc/custom/summonmonsters.txt line 7
    parse_callfunc: expected ')' to close argument list
     2 :     .@mob_id = getarg(0);
     3 :     .@qty = getarg(1);
     4 :
     5 :     if (.@mob_id > 0 && .@qty > 0) {
     6 :         .@command$ = "@summony " + .@mob_id + " " + .@qty;
*    7 :         atcommand(.@command$, getcharid(3));
     8 :     }
     9 : }

Could someone please help me identify what might be causing this error and how to resolve it? Any suggestions or insights would be greatly appreciated!

Thank you in advance!

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
atcommand "<command>";

Hi, atcommand has no parameter for char/account ID.

Find:

        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));

Replace:

        .@command$ = "@summony " + .@mob_id + " " + .@qty + " " + getcharid(3);
        atcommand(.@command$);

 

Edited by Racaae
fix formatting
  • 0
Posted
On 7/3/2024 at 6:26 AM, Racaae said:
atcommand "<command>";

Hi, atcommand has no parameter for char/account ID.

Find:

        .@command$ = "@summony " + .@mob_id + " " + .@qty;
        atcommand(.@command$, getcharid(3));

Replace:

        .@command$ = "@summony " + .@mob_id + " " + .@qty + " " + getcharid(3);
        atcommand(.@command$);

 

Thank you so much for you correction , my problem was solved now. have a great day 🙂

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...