this is probably a really noobish question but i can't take it anymore! i have to find out...
how do i make it so that things in my inventory appear marked by an icon instead of red words? can i make it so that objecta are in my inventory rather than stats that are totally different to the object they are meant to refer to?
ID:165591
Nov 25 2006, 2:05 am
|
|
In response to GhostAnime
|
|
Great, that works, now to equip. What do i do so that if i click a sword, for example, it would appear on the same spot as me, follow me wherever i went (so it looked like i was holding it) and no one else can pick it up when i'm holding it?
|
In response to Adam357
|
|
You want to look up on 'overlays'
usr.overlays+=image('X.dmi',"XX") - GhostAnime |
In response to GhostAnime
|
|
oh yeah, overlay, how could i forget? except that Click() doesn't seem to work. can you edit this so that it works as i explained?
if(statpanel("inventory")) Sorry, it's just that i've never tried anything involving Click() or this inventory images thing. |
In response to Adam357
|
|
anyone? please? i just want to know what to put BEFORE the overlays things...
|
In response to Adam357
|
|
obj Thats an example of a obj verb...I think... |
In response to Revojake
|
|
Click() is a proc!!! Like New(), Del(), Login(), etc.
obj/Apple Also, that's a horrible thing to do Adam (the new obj in statpanel) because stat panels are updated quite frequently... so you'll be creating a huge amount of useless object. My solution is you should make a predetermined list: mob/var/Statobj = newlist(/obj/health,/obj/shield) // newlist is like list(new A,new B,new C) etc - GhostAnime |
In response to GhostAnime
|
|
i know its a proc but where do i put it!? it's just...not...working!!! look.
obj at least i'm going somewhere with this. but if i click it in my inventory, nothing happens, and if i click one thats on the map, it goes small but doesn't follow me. |
In response to Adam357
|
|
usr.overlays += image('wooden_sword.dmi') Did you even looked up overlays in the DM Reference? You are adding two overlay icons together, one which has an icon state and the other doesn't! The problem may be you didn't enter the icon_state, assuming the icon file has no default state to change to if there's any mistake. BTW, that positioning for Click() is correct and if I were you, I would add safety checks (such as if the item was in the inventory, one step away, etc). - GhostAnime |
In response to GhostAnime
|
|
......
so are you saying that something does have an icon state and shouldn't or something doesn't and should? and where in the DM guide is an overlay explanation? |
In response to Adam357
|
|
Note I said DM Reference not DM Guide (Reference = F1 in DM).
usr.overlays+=image(src.icon,src.icon_state) http://www.byond.com/docs/ref/info.html#/atom/var/overlays As you may know, if an icon file has no default icon_state (the blank icon_state) and if you mistype an icon_state, it'll go to the default. If there's no default IS, it'll be blank... so always try to have a 'safety default' (Like a huge red X) to signify if something is wrong [f you have no default IS]. - GhostAnime |
In response to GhostAnime
|
|
problem with theories:
obj when i do that (or close enough, trust me) it doesn't even say "click!" to me, so the problem is something to do with the Click(), not the overlays or the icon states. |
In response to GhostAnime
|
|
should you not use "usr" here since its in a proc or is Click() an exception to that rule?
|
In response to KirbyAllStar
|
|
Anything that is directly called by (and limited only to) the client/player, such as: Click(), DblClick(), /verb can use 'usr' safely... things that are called by the program itself, such as Bump(), Move(), or anything that can be called indirectly and NOT limited to the client/player should avoid using 'usr'.
here's some links of interest: http://bwicki.byond.com/ByondBwicki.dmb?UsrLecture http://bwicki.byond.com/ByondBwicki.dmb?WhatIsUsr http://bwicki.byond.com/ByondBwicki.dmb?UsrIsEvil http://bwicki.byond.com/ByondBwicki.dmb?WhatIsSrc - GhostAnime |
In response to GhostAnime
|
|
I dislike using image() to add overlays. It tends to make your sprites stick to you...I prefer adding src itself directly to your overlays, like you would directly equip it to a var not make the var an icon or the like. But that's just me.
|
In response to GhostAnime
|
|
Thanks I've been looking for things to explain this to me, I understand why you shouldn't use usr but I've been wondering how not to use usr
|
In response to KirbyAllStar
|
|
Usr is only safely allowed in verbs, Click(), and DblClick()
|
I recommend reading the whole article and checking out other tutorials in BYONDscape (er, not sure if you're able to read it though)
- GhostAnime