Jump to content
  • 0

downrefitem debug


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

hi guys... sorry for being persistent but i really need the source w/o any form of error.. i'm willing to pay even atleast 10$+ just for somebody to put some time into it..

	/*==========================================
 * Downgrades an Equipment Part by -1 . [Masao]
 *------------------------------------------*/
BUILDIN_FUNC(downrefitem) {
    short i = -1, down = 1;
    int pos;
    TBL_PC *sd;
	    sd = script_rid2sd(st);
    if( sd == NULL )
        return 0;
    pos = script_getnum(st,2);
    if (script_hasdata(st, 3))
        down = script_getnum(st, 3);
	    if (pos > 0 && pos <= ARRAYLENGTH(equip))
        i = pc_checkequip(sd,equip[pos-1]);
    if (i >= 0) {
        unsigned int ep = sd->status.inventory[i].equip;
	        //Logs items, got from (N)PC scripts [Lupus]
        log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
	        pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
        sd->status.inventory[i].refine -= down;
        sd->status.inventory[i].refine = cap_value( sd->status.inventory[i].refine, 0, MAX_REFINE);
	        clif_refine(sd->fd,2,i,sd->status.inventory[i].refine);
        clif_delitem(sd,i,1,3);
	        //Logs items, got from (N)PC scripts [Lupus]
        log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
	        clif_additem(sd,i,1,0);
        pc_equipitem(sd,i,ep);
        clif_misceffect(&sd->bl,2);
        script_pushint(st, sd->status.inventory[i].refine);
        return 1;
    }
    ShowError("buildin_downrefitem: No item equipped at pos %d (CID=%d/AID=%d).\n", pos, sd->status.char_id, sd->status.account_id);
    script_pushint(st, -1);
    return 0;
}



here's the source code from 15peaces.... its for 3ceAm by the way and i know this is rathena but i don't know any forum i can go now for 3ceAm.... 

everytime the downrefitem excutes from the script. this debug something always appear (refer on the picture)

1234.PNG

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

nope, its the source code

I still remember this ... since eathena times,
the script command actually return 1; means false -> show a debug message
and return 0; means success
https://github.com/rathena/rathena/blob/master/src/map/script.hpp#L128
t
hat's why when you do return SCRIPT_CMD_SUCCESS;, actually means return 0;

all you have to do is change return 1; into return 0; into the source code,
and return 0; into return 1; .... if you are still using eamod

btw,
hercules did it by swap the return 0; into return true;
rathena did it by return SCRIPT_CMD_SUCCESS;

Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

9 hours ago, caspa said:

hi guys... sorry for being persistent but i really need the source w/o any form of error.. i'm willing to pay even atleast 10$+ just for somebody to put some time into it..
 


	/*==========================================
 * Downgrades an Equipment Part by -1 . [Masao]
 *------------------------------------------*/
BUILDIN_FUNC(downrefitem) {
    short i = -1, down = 1;
    int pos;
    TBL_PC *sd;
	    sd = script_rid2sd(st);
    if( sd == NULL )
        return 0;
    pos = script_getnum(st,2);
    if (script_hasdata(st, 3))
        down = script_getnum(st, 3);
	    if (pos > 0 && pos <= ARRAYLENGTH(equip))
        i = pc_checkequip(sd,equip[pos-1]);
    if (i >= 0) {
        unsigned int ep = sd->status.inventory[i].equip;
	        //Logs items, got from (N)PC scripts [Lupus]
        log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
	        pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
        sd->status.inventory[i].refine -= down;
        sd->status.inventory[i].refine = cap_value( sd->status.inventory[i].refine, 0, MAX_REFINE);
	        clif_refine(sd->fd,2,i,sd->status.inventory[i].refine);
        clif_delitem(sd,i,1,3);
	        //Logs items, got from (N)PC scripts [Lupus]
        log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
	        clif_additem(sd,i,1,0);
        pc_equipitem(sd,i,ep);
        clif_misceffect(&sd->bl,2);
        script_pushint(st, sd->status.inventory[i].refine);
        return 1;
    }
    ShowError("buildin_downrefitem: No item equipped at pos %d (CID=%d/AID=%d).\n", pos, sd->status.char_id, sd->status.account_id);
    script_pushint(st, -1);
    return 0;
}



here's the source code from 15peaces.... its for 3ceAm by the way and i know this is rathena but i don't know any forum i can go now for 3ceAm.... 

everytime the downrefitem excutes from the script. this debug something always appear (refer on the picture)

1234.PNG

This is most likely caused by the NPC itself.. check script.. or post it here

Edited by pajodex
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

2 hours ago, pajodex said:

This is most likely caused by the NPC itself.. check script.. or post it here

 
sl_mall01,103,175,3    script    Thor [Blacksmith]    826,{
//------------------------------
getmapxy( .@npc_map$,.@npc_x,.@npc_y,1 );
getmapxy( .@player_map$,.@player_x,.@player_y,0 );
//------------------------------
if( distance( .@npc_x,.@npc_y,.@player_x,.@player_y ) > 6 ){
    message strcharinfo(0),"Thor : I can't refine your item if you're too far away, Please come closer!";
    close;
}else{
    disable_items;
    mes "[ Thor ]";
    mes "Hello ^0000ff"+strcharinfo(0)+"^000000,";
    mes "I am Thor, a blacksmith who";
    mes "has a special ability.";
    mes "I can refine items that even if";
    mes "it fails, you don't lose the";
    mes "equipment at all.";
    next;
    mes "[ Thor ]";
    mes "However, the refinement level decreases by ^0000ff1^000000, and i can only";
    mes "refine items that are ^CC0000+7 to +9^000000.";
    next;
    mes "[ Thor ]";
    mes "So, what'd ya think?";
    mes "Do you have something you'd";
    mes "like me to refine?";
    next;
    setarray .@position$[1],"Head","Body","Left Hand","Right Hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
    set .@menu$,"";
    for(set .@i,1; .@i<=10; set .@i,.@i+1)
        set .@menu$,.@menu$+"^0000ff"+((getequipisequiped(.@i))?getequipname(.@i):"^000000"+.@position$[.@i]+"-[^ff0000Not Equipped^000000]")+":";
    set .@part, select(.@menu$);
    if (!getequipisequiped(.@part)) {
        mes "[ Thor ]";
        switch(.@part) {
        case 1:
            mes "I'm a blacksmith, not a hairstylist.";
            break;
        case 2:
            mes "With my hammer, I will make you a star of the sky.";
            break;
        case 3:
        case 4:
            mes "Making artificial hands is not my specialty.";
            break;
        case 5:
            mes "Bring out the item so I can refine it!";
            break;
        case 6:
            mes "Where is this foot odor coming from?";
            break;
        case 7:
        case 8:
            mes "Where is the accessory?";
            break;
        case 9:
            mes "What do you want me to refine?";
            break;
        case 10:
            mes "Huh? What do you want me to do?";
            break;
        }
        close;
    }
    if (!getequipisenableref(.@part)) {
        mes "[ Thor ]";
        mes "This item can't be refined.";
        close;
    }
    if (getequiprefinerycnt(.@part) < 7 || getequiprefinerycnt(.@part) > 9) {
        mes "[ Thor ]";
        mes "I only handle items with refine level from +7 to +9.";
        close;
    }
    switch(getequipweaponlv(.@part)) {
    default:
    case 0:
        set .@price,20000;
        set .@material,6241; //HD_Elunium
        break;
    case 1:
    case 2:
    case 3:
    case 4:
        set .@price,20000;
        set .@material,6240; //HD_Oridecon
        break;
    }
    mes "[ Thor ]";
    mes "In order to refine the item";
    mes "you selected, I'm gonna need";
    mes "^0000ff1x "+getitemname(.@material)+"^000000";
    mes "and ^ff000020,000 zeny^000000 as a fee.";
    mes "Do you have them now?";
    next;
    if(select("Yes:No") == 2) {
        mes "[ Thor ]";
        mes "Okay, i will wait until you're ready.";
        close;
    }
    if (getequippercentrefinery(.@part) < 100) {
        mes "[ Thor ]";
        mes "I can feel that this item will likely fail when refined!";
        mes "Oh well! even if it fails.";
        mes "It will only downgrades";
        mes "by 1 refine level...";
        mes "Do you want to continue refining?";
        next;
        if(select("Yes:No") == 2) {
            mes "[ Thor ]";
            mes "Haha!! I don't blame you.";
            mes "Only those who overcome fear of failure will obtain a masterpiece.";
            close;
        }
    }
    if (countitem(.@material) == 0 || Zeny < .@price) {
        mes "[ Thor ]";
        mes "Hmmm, didn't you just say you have the purified stones right now?";
        close;
    }
    delitem .@material,1;
    set Zeny, Zeny-.@price;
    mes "[ Thor ]";
    mes "^0000ffClanG, ClAnG, CLaNG!!!";
    if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
        successrefitem .@part;
        next;
        emotion e_no1;
        mes "[ Thor ]";
        mes "Ahhhhh!! the sound of success refreshes my mind";
        mes "everytime i hear it.";
        mes "Here you go!!";
        mes "I have refined it flawlessly...";
        close;
    }
    downrefitem .@part,1;
    next;
    emotion e_omg;
    mes "[ Thor ]";
    mes "Oops!! looks like i failed.";
    next;
    mes "[ Thor ]";
    mes "However, do not be discourage!";
    mes "The item is still there.";
    mes "   ";
    mes "Just try your luck next time...";
    close;
    }
}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

3 minutes ago, caspa said:

 


 
sl_mall01,103,175,3    script    Thor [Blacksmith]    826,{
//------------------------------
getmapxy( .@npc_map$,.@npc_x,.@npc_y,1 );
getmapxy( .@player_map$,.@player_x,.@player_y,0 );
//------------------------------
if( distance( .@npc_x,.@npc_y,.@player_x,.@player_y ) > 6 ){
    message strcharinfo(0),"Thor : I can't refine your item if you're too far away, Please come closer!";
    close;
}else{
    disable_items;
    mes "[ Thor ]";
    mes "Hello ^0000ff"+strcharinfo(0)+"^000000,";
    mes "I am Thor, a blacksmith who";
    mes "has a special ability.";
    mes "I can refine items that even if";
    mes "it fails, you don't lose the";
    mes "equipment at all.";
    next;
    mes "[ Thor ]";
    mes "However, the refinement level decreases by ^0000ff1^000000, and i can only";
    mes "refine items that are ^CC0000+7 to +9^000000.";
    next;
    mes "[ Thor ]";
    mes "So, what'd ya think?";
    mes "Do you have something you'd";
    mes "like me to refine?";
    next;
    setarray .@position$[1],"Head","Body","Left Hand","Right Hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
    set .@menu$,"";
    for(set .@i,1; .@i<=10; set .@i,.@i+1)
        set .@menu$,.@menu$+"^0000ff"+((getequipisequiped(.@i))?getequipname(.@i):"^000000"+.@position$[.@i]+"-[^ff0000Not Equipped^000000]")+":";
    set .@part, select(.@menu$);
    if (!getequipisequiped(.@part)) {
        mes "[ Thor ]";
        switch(.@part) {
        case 1:
            mes "I'm a blacksmith, not a hairstylist.";
            break;
        case 2:
            mes "With my hammer, I will make you a star of the sky.";
            break;
        case 3:
        case 4:
            mes "Making artificial hands is not my specialty.";
            break;
        case 5:
            mes "Bring out the item so I can refine it!";
            break;
        case 6:
            mes "Where is this foot odor coming from?";
            break;
        case 7:
        case 8:
            mes "Where is the accessory?";
            break;
        case 9:
            mes "What do you want me to refine?";
            break;
        case 10:
            mes "Huh? What do you want me to do?";
            break;
        }
        close;
    }
    if (!getequipisenableref(.@part)) {
        mes "[ Thor ]";
        mes "This item can't be refined.";
        close;
    }
    if (getequiprefinerycnt(.@part) < 7 || getequiprefinerycnt(.@part) > 9) {
        mes "[ Thor ]";
        mes "I only handle items with refine level from +7 to +9.";
        close;
    }
    switch(getequipweaponlv(.@part)) {
    default:
    case 0:
        set .@price,20000;
        set .@material,6241; //HD_Elunium
        break;
    case 1:
    case 2:
    case 3:
    case 4:
        set .@price,20000;
        set .@material,6240; //HD_Oridecon
        break;
    }
    mes "[ Thor ]";
    mes "In order to refine the item";
    mes "you selected, I'm gonna need";
    mes "^0000ff1x "+getitemname(.@material)+"^000000";
    mes "and ^ff000020,000 zeny^000000 as a fee.";
    mes "Do you have them now?";
    next;
    if(select("Yes:No") == 2) {
        mes "[ Thor ]";
        mes "Okay, i will wait until you're ready.";
        close;
    }
    if (getequippercentrefinery(.@part) < 100) {
        mes "[ Thor ]";
        mes "I can feel that this item will likely fail when refined!";
        mes "Oh well! even if it fails.";
        mes "It will only downgrades";
        mes "by 1 refine level...";
        mes "Do you want to continue refining?";
        next;
        if(select("Yes:No") == 2) {
            mes "[ Thor ]";
            mes "Haha!! I don't blame you.";
            mes "Only those who overcome fear of failure will obtain a masterpiece.";
            close;
        }
    }
    if (countitem(.@material) == 0 || Zeny < .@price) {
        mes "[ Thor ]";
        mes "Hmmm, didn't you just say you have the purified stones right now?";
        close;
    }
    delitem .@material,1;
    set Zeny, Zeny-.@price;
    mes "[ Thor ]";
    mes "^0000ffClanG, ClAnG, CLaNG!!!";
    if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
        successrefitem .@part;
        next;
        emotion e_no1;
        mes "[ Thor ]";
        mes "Ahhhhh!! the sound of success refreshes my mind";
        mes "everytime i hear it.";
        mes "Here you go!!";
        mes "I have refined it flawlessly...";
        close;
    }
    downrefitem .@part,1;
    next;
    emotion e_omg;
    mes "[ Thor ]";
    mes "Oops!! looks like i failed.";
    next;
    mes "[ Thor ]";
    mes "However, do not be discourage!";
    mes "The item is still there.";
    mes "   ";
    mes "Just try your luck next time...";
    close;
    }
}

 

Here's the script sir, but i'm pretty sure this is not a script thing and more of a source thing because there's no error on whatsoever on the script. 
the debug always happen whenever the downrefitem func executes.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

12 minutes ago, AnnieRuru said:

nope, its the source code

I still remember this ... since eathena times,
the script command actually return 1; means false -> show a debug message
and return 0; means success
https://github.com/rathena/rathena/blob/master/src/map/script.hpp#L128
t
hat's why when you do return SCRIPT_CMD_SUCCESS;, actually means return 0;

all you have to do is change return 1; into return 0; into the source code, if you are still using eamod

btw,
hercules did it by swap the return 0; into return true;
rathena did it by return SCRIPT_CMD_SUCCESS;

GOOD LAWWWDDD!!! annie saving assess since eathena times... thank you so much... ❤️

Link to comment
Share on other sites

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...