Jump to content
  • 0

Iteminfo showing the item script


NightTerror

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   2
  • Joined:  01/04/12
  • Last Seen:  

Hi guys,

i just wanted to edit the @iteminfo command for my personal needs. Everything went fine, save for the item script.

I changed the code of the function ACMD_FUNC(iteminfo) from this:

    for (i = 0; i < count; i++) {
       item_data = item_array[i];
       sprintf(atcmd_output, "Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s",
           item_data->name,item_data->jname,item_data->slot,item_data->nameid,
           itemdb_typename(item_data->type),
           (item_data->script==NULL)? "None" : "With script"
       );
       clif_displaymessage(fd, atcmd_output);

       sprintf(atcmd_output, "NPC Buy:%dz, Sell:%dz | Weight: %.1f ", item_data->value_buy, item_data->value_sell, item_data->weight/10. );
       clif_displaymessage(fd, atcmd_output);

       if (item_data->maxchance == -1)
           strcpy(atcmd_output, " - Available in the shops only.");
       else if (item_data->maxchance)
           sprintf(atcmd_output, " - Maximal monsters drop chance: %02.02f%%", (float)item_data->maxchance / 100 );
       else
           strcpy(atcmd_output, " - Monsters don't drop this item.");
       clif_displaymessage(fd, atcmd_output);

   }
   return 0;

to this:

    clif_disp_onlyself_type(sd, "====================================", 3);
   for (i=0;i<count;i++)
   {
       item_data = item_array[i];

       sprintf(atcmd_output, "nr");
       clif_disp_onlyself_type(sd, atcmd_output,3);

       if(!item_data->slot)
       {
           sprintf(atcmd_output, "[%d] %s / %s",item_data->nameid,item_data->name,item_data->jname);
           clif_disp_onlyself_type(sd, atcmd_output,3);        

       }
       else
       {
           sprintf(atcmd_output, "[%d] %s / %s[%d]",item_data->nameid,item_data->name,item_data->jname,item_data->slot);
           clif_disp_onlyself_type(sd, atcmd_output,3);
       }

       sprintf(atcmd_output, "Script: %s",item_data->script);
       clif_disp_onlyself_type(sd, atcmd_output,2);

   }
   clif_disp_onlyself_type(sd, "====================================", 3);

   return 0;

Now if I use the @iteminfo command then I'm getting this result: 923lcu2i.jpg

As you can see, the script field is just showing weird symbols instead of the actual item script. I already searched the forum for some solutions, but i haven't found anything. I hope you guys can help me with this.

Thanks in advance!

Edited by NightTerror
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  57
  • Reputation:   15
  • Joined:  12/25/11
  • Last Seen:  

I'm afraid it's not that easy. Since item_data->script is a struct called script_code (if I remember correctly from top of my head) you can't just cast it to type char. The code of the script is, at that point, not even stored as plain-text - it has already been parsed.

You would have to look around in script.c (or itemdb.c) somewhere and search for the snippet where the item script is parsed and then store it somewhere else as plain-text. That way you can display it via sprintf. I don't know how good you are at C and handling the source code, but this may require some experience to be accomplished

Edited by Realusion
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...