Difference between revisions of "Talk:GetEquipmentSlot"
Jump to navigation
Jump to search
imported>Babij (Example code) |
imported>Babij m (signed my name) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Hmm... I wasted a several hours on this damn function. I was writing a script to get a companion character to wear certain clothing depending on particular circumstances. Long story short, I wanted my guy to loop through his inventory and put on a pair of shoes. I finally got the damn thing to work using the following code: | Hmm... I wasted a several hours on this damn function. I was writing a script to get a companion character to wear certain clothing depending on particular circumstances. Long story short, I wanted my guy to loop through his inventory and put on a pair of shoes. I finally got the damn thing to work using the following code: | ||
< | <br><br> | ||
<pre> | |||
short InvPos | |||
ref pInvObj | |||
set InvPos to 0 | |||
Label | |||
set pInvObj to (GaroWorldRef.GetInventoryObject InvPos) | |||
if pInvObj | |||
set InvPos to (InvPos + 1) | |||
;if (pInvObj.GetEquipmentSlot == 5) | |||
if(GetEquipmentSlot pInvObj == 5) | |||
GaroWorldRef.EquipItem pInvObj | |||
message "I put on my shoes" | |||
endif | |||
Goto | |||
endif | |||
</pre><br><br> | |||
The key line of course is ''if(GetEquipmentSlot pInvObj == 5)''. Note the commented out line above it, which is apparently incorrect code, and will always return 0. Probably has something to do with my confusion between references and objectIds, but I figured I'd post this up in case anyone else has this problem. | The key line of course is ''if(GetEquipmentSlot pInvObj == 5)''. Note the commented out line above it, which is apparently incorrect code, and will always return 0. Probably has something to do with my confusion between references and objectIds, but I figured I'd post this up in case anyone else has this problem. | ||
--[[User:Babij|Babij]] 09:14, 20 July 2010 (EDT) |
Latest revision as of 08:14, 20 July 2010
Hmm... I wasted a several hours on this damn function. I was writing a script to get a companion character to wear certain clothing depending on particular circumstances. Long story short, I wanted my guy to loop through his inventory and put on a pair of shoes. I finally got the damn thing to work using the following code:
short InvPos ref pInvObj set InvPos to 0 Label set pInvObj to (GaroWorldRef.GetInventoryObject InvPos) if pInvObj set InvPos to (InvPos + 1) ;if (pInvObj.GetEquipmentSlot == 5) if(GetEquipmentSlot pInvObj == 5) GaroWorldRef.EquipItem pInvObj message "I put on my shoes" endif Goto endif
The key line of course is if(GetEquipmentSlot pInvObj == 5). Note the commented out line above it, which is apparently incorrect code, and will always return 0. Probably has something to do with my confusion between references and objectIds, but I figured I'd post this up in case anyone else has this problem. --Babij 09:14, 20 July 2010 (EDT)