Jump to content

Should we use item/npc/object IDs or names? When/Why?


fixthissite

Recommended Posts

When looking for/interacting with an item/npc/object, is it preferred to use the ID or the name? Are there times when one would be preferred over the other? What's the benifit from using a name rather than an ID and vice versa?

I haven't seen this question answered publicly, and I'm sure it'll be helpful seeing how it's a common aspect of scripting

Link to comment
Share on other sites

Ye,

 

Object Ids change frequently (pretty much every RS update), so basically you should use anything other than IDs to define them... Index/name etc

 

As for item IDs, these never change but using names is probably better anyway because a name is guarenteed never to change :) also easier to read when using names.

 

apa

  • Like 2
Link to comment
Share on other sites

i dont think item ids ever change but objects ids sometimes do. It will be easier to just use names for objects incase of a rs update.

 

Hope my nooby self helped somewhat

  

Ye,

 

Object Ids change frequently (pretty much every RS update), so basically you should use anything other than IDs to define them... Index/name etc

 

As for item IDs, these never change but using names is probably better anyway because a name is guarenteed never to change :) also easier to read when using names.

 

apa

  

Only downside to using the name is it applies to noted items aswell as unnoted :3

  

Item id's never change, so thats not a problem.

NPc's and gameobjects do change, so you should use names for those :)

 

There also more advanced ways, like using models to search for entities ^^

 

Khaleesi

So it seems you should use IDs for items to avoid name collisions with noted items and names for objects incase their IDs change. What about NPCs?

  • Like 1
Link to comment
Share on other sites

      

So it seems you should use IDs for items to avoid name collisions with noted items and names for objects incase their IDs change. What about NPCs?

 

Same applies to NPCs I believe. Their IDs frequently change. I recommend using names for NPCs

 

I try and avoid using ids for anything tbh. Either names (or if they dont work eg multiple npcs with same name next to eachother), I find some other difference between them such as modified colours or index

  • Like 1
Link to comment
Share on other sites

      

So it seems you should use IDs for items to avoid name collisions with noted items and names for objects incase their IDs change. What about NPCs?

 

Item id's never change, so you can use them if you want to smile.png

 

Entities have their ID changed every update.

This means, NPC's and objects will have swapped ID's.

 

So you should use names.

 

NOte: Jagex will be a bitch and call some npcs/gameobjects "null".

You should use models to get those specific entities ^^

 

Khaleesi

Edited by Khaleesi Scripts
  • Like 1
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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