Jump to content
  • 0

Func set - add " = "


JohnyRox

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  02/26/15
  • Last Seen:  

Hi guys

 

My emulator only understands this:

 

set Zeny, Zeny - 1000;

 

Now

 

Zeny -= 1000;

Zeny += 1000;

Zeny = 1000;

 

or

 

.@qualquercoisa = 1000;

 

He does not understand .

 

Can anyone give me tips on how to add this feature or because it is not working , I'm scouring the script.c but it 's hard not to know where to start ?

 

 

Função SET -

 

rAthena Currently

BUILDIN(__setr) {
    TBL_PC* sd = NULL;
    struct script_data* data;
    //struct script_data* datavalue;
    int64 num;
    const char* name;
    char prefix;

    data = script_getdata(st,2);
    //datavalue = script_getdata(st,3);
    if (!data_isreference(data) || reference_toconstant(data)) {
        ShowError("script:set: nao e uma variavel\n");
        script->reportdata(script_getdata(st,2));
        st->state = END;
        return false;
    }

    num = reference_getuid(data);
    name = reference_getname(data);
    prefix = *name;

    if (not_server_variable(prefix)) {
        sd = script->rid2sd(st);
        if (sd == NULL) {
            ShowError("script:set: nao existe jogador anexado para a variavel '%s'\n", name);
            return true;
        }
    }

#if 0
    // TODO: see de43fa0f73be01080bd11c08adbfb7c158324c81
    if (data_isreference(datavalue)) {
        // the value being referenced is a variable
        const char* namevalue = reference_getname(datavalue);

        if (!not_array_variable(*namevalue)) {
            // array variable being copied into another array variable
            if (sd == NULL && not_server_variable(*namevalue) && (sd = script->rid2sd(st)) == NULL) {
                // player must be attached in order to copy a player variable
                ShowError("script:set: nao existe jogador anexado para a variavel '%s'\n", namevalue);
                return true;
            }

            if (is_string_variable(namevalue) != is_string_variable(name)) {
                // non-matching array value types
                ShowWarning("script:set: duas variaveis arrays nao coicidem o mesmo tipo.\n");
                return true;
            }

            // push the maximum number of array values to the stack
            script->push_val(st->stack, C_INT, SCRIPT_MAX_ARRAYSIZE,NULL);

            // call the copy array method directly
            return buildin_copyarray(st);
        }
    }
#endif

    if (script_hasdata(st, 4)) {
        // Optional argument used by post-increment/post-decrement constructs to return the previous value
        if (is_string_variable(name)) {
            script_pushstrcopy(st, script_getstr(st, 4));
        } else {
            script_pushint(st, script_getnum(st, 4));
        }
    } else {
        // return a copy of the variable reference
        script_pushcopy(st,2);
    }

    if (is_string_variable(name))
        script->set_reg(st,sd,num,name,(void*)script_getstr(st,3),script_getref(st,2));
    else
        script->set_reg(st,sd,num,name,(void*)h64BPTRSIZE(script_getnum(st,3)),script_getref(st,2));

    return true;
}



My old rAthena.

BUILDIN_FUNC(set)
{
    TBL_PC* sd = NULL;
    struct script_data* data;
    int num;
    const char* name;
    char prefix;

    data = script_getdata(st,2);
    if( !data_isreference(data) )
    {
        ShowError("script:set: not a variable\n");
        script_reportdata(script_getdata(st,2));
        st->state = END;
        return 1;
    }

    num = reference_getuid(data);
    name = reference_getname(data);
    prefix = *name;

    if( not_server_variable(prefix) )
    {
        sd = script_rid2sd(st);
        if( sd == NULL )
        {
            ShowError("script:set: no player attached for player variable '%s'\n", name);
            return 0;
        }
    }

    if( is_string_variable(name) )
        set_reg(st,sd,num,name,(void*)script_getstr(st,3),script_getref(st,2));
    else
        set_reg(st,sd,num,name,(void*)script_getnum(st,3),script_getref(st,2));

    // return a copy of the variable reference
    script_pushcopy(st,2);

    return 0;
}

 Ai eu tentei trocar toda função set pela setr, trocando em todos outros arquivos utilizavam ela

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.

×
×
  • Create New...