Equipping Problems
KReed92
29 Sept 2013, 17:52Hi guys, I've just spent the last hour trying to work this out but finally decided to give up and ask for help, lol.
I'm testing out the idea of equpping and uneuipping items (in this case, a handgun).
When you first equip the handgun, it's alias changes to 'handgun (equipped)' which works fine, then when unequipping it, it changes back to 'handgun', but if I then try to equip the handgun again, it's alias becomes 'Object: handgun (equipped)' even though it worked properly the first time. I've tried all sorts to make it just say the original bit but for whatever reason it insists on putting 'Object:' before it.
I am now contemplating the idea of having seperate objects to switch between when equipping which I really don't want to do because it's twice as much work. Can anyone help stop it from putting that weird 'Object:' bit in there?
Thanks a lot in advance.
EDIT: I can't remember what I did differently but at one point I was getting "False (equiped)" instead of "Object: handgun (equipped)".
I'm testing out the idea of equpping and uneuipping items (in this case, a handgun).
When you first equip the handgun, it's alias changes to 'handgun (equipped)' which works fine, then when unequipping it, it changes back to 'handgun', but if I then try to equip the handgun again, it's alias becomes 'Object: handgun (equipped)' even though it worked properly the first time. I've tried all sorts to make it just say the original bit but for whatever reason it insists on putting 'Object:' before it.
I am now contemplating the idea of having seperate objects to switch between when equipping which I really don't want to do because it's twice as much work. Can anyone help stop it from putting that weird 'Object:' bit in there?
Thanks a lot in advance.
EDIT: I can't remember what I did differently but at one point I was getting "False (equiped)" instead of "Object: handgun (equipped)".

jaynabonne
29 Sept 2013, 18:17If you could post the code (or the relevant parts), I'm sure we can. I've only seen the "Object:" thing output by msg, so I'm not sure how it could end up in a string.
HegemonKhan
29 Sept 2013, 20:49this thread's content seems to possibly be related+relevant for here too:
viewtopic.php?f=10&t=3938
the "Object: Name" seems to be from DisplayList (Object.NewObjectList_variable_name, true)
so, maybe your code has the same mistake that was going on in the other poster's code, as well.
-------------
I looked at the wiki pages on these "code items", but couldn't find any documentation that would cause the "Object: Name" to show.
Probably would have to look at the core coding's scripting itself, to see what is causing it.
viewtopic.php?f=10&t=3938
the "Object: Name" seems to be from DisplayList (Object.NewObjectList_variable_name, true)
so, maybe your code has the same mistake that was going on in the other poster's code, as well.
-------------
I looked at the wiki pages on these "code items", but couldn't find any documentation that would cause the "Object: Name" to show.
Probably would have to look at the core coding's scripting itself, to see what is causing it.
KReed92
29 Sept 2013, 21:11I've added the file here 


jaynabonne
29 Sept 2013, 21:27In your "unequip", change this:
to this:
You were setting the handgun's alias to itself (which is an object).
handgun.alias = handgun
to this:
handgun.alias = "handgun"
You were setting the handgun's alias to itself (which is an object).

KReed92
29 Sept 2013, 21:32*facepalm* *head desk* FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF-Idiot...
I can't believe I did something that stupid :S
Thank you, lol... It's working now.
I can't believe I did something that stupid :S
Thank you, lol... It's working now.

jaynabonne
29 Sept 2013, 21:34Just a note: you will see "Object: xxx" when you try to output an object as an object (e.g. msg(someobjectref)). The output code automatically prepends "Object: " so you know you've output an object reference, and not just a string.
HegemonKhan
29 Sept 2013, 21:43you should take a look at (or just use too) Chase's Wearables Library:
viewtopic.php?f=18&t=2901
the key things that you're missing are:
http://quest5.net/wiki/GetDisplayName
http://quest5.net/wiki/GetDisplayAlias
From Chase's Wearables Library's Coding:
To Equip (DoWear Function):
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
so for your code:
handgun.display = GetDisplayName (handgun)
handgun.alias = GetDisplayAlias (handgun) + " (equipped)"
Chase also accounts (codes) for not being able to drop the equipped gear (which you don't do):
object.original_drop = object.drop
// you could also do this instead by just setting: handgun.drop=false
and due to Chase's use of "GetDisplayName", this is needed with it:
To Unequip (DoRemove Function):
object.display = null
for your code, it'd be:
handgun.display = null
-----------------------------------
so, while it'd be hard to figure out exactly what and why stuff is going on for you in your code, we do know that you need to use the (To Equip Function) "GetDisplayName" and (To Unequip Function) "handgun.display=null", to hopefully wipe out your code errors, if I got this understood correctly, lol.
viewtopic.php?f=18&t=2901
the key things that you're missing are:
http://quest5.net/wiki/GetDisplayName
http://quest5.net/wiki/GetDisplayAlias
From Chase's Wearables Library's Coding:
To Equip (DoWear Function):
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
so for your code:
handgun.display = GetDisplayName (handgun)
handgun.alias = GetDisplayAlias (handgun) + " (equipped)"
Chase also accounts (codes) for not being able to drop the equipped gear (which you don't do):
object.original_drop = object.drop
// you could also do this instead by just setting: handgun.drop=false
and due to Chase's use of "GetDisplayName", this is needed with it:
To Unequip (DoRemove Function):
object.display = null
for your code, it'd be:
handgun.display = null
-----------------------------------
so, while it'd be hard to figure out exactly what and why stuff is going on for you in your code, we do know that you need to use the (To Equip Function) "GetDisplayName" and (To Unequip Function) "handgun.display=null", to hopefully wipe out your code errors, if I got this understood correctly, lol.
HegemonKhan
29 Sept 2013, 21:45KReed92 wrote:*facepalm* *head desk* FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF-Idiot...
I can't believe I did something that stupid :S
Thank you, lol... It's working now.
I'm guilty as well, as can be seen by my above post...
what a simple mistake... (yet that is what makes them so hard to spot or realize, but I still feel stupid for it, lol)
my lesson learned (and trying to remember this hard thing to remember ~ for me anyways, lol):
be careful when using an Object's Name Attribute (no quotation marks) as this GETS the object itself, not it's Alias Attribute. Also, just don't have the Name and Alias Attributes being the same, which will help avoid this problem too, lol.
quotation marks = NEVER (?I think?) gets the Object itself
no quation marks = if you want to GET the Object itself

Slent
30 Sept 2013, 06:45I have worked around this issue by giving each of my equipable items an attribute called "orgAlias". This way, in my unequip script, I set the object.alias = object.orgAlias. Dunno if this is a pretty way to do it, but it works 
