View unanswered posts | View active topics It is currently Wed Oct 01, 2014 12:12 pm



Reply to topic  [ 3 posts ] 
objsetitemdata and itmgetdata problem 
Author Message
Fleet Admiral
Fleet Admiral
User avatar

Joined: Tue Aug 26, 2008 12:02 am
Posts: 2027
Post objsetitemdata and itmgetdata problem
I'm having inexplicable problems with itemdata. "lastMunition" is not getting stored, even though "fireCount" is with identical syntax.

Code:
(setq WE_fireUnlauncher (lambda nil
   (block (ammolist launcher shot speed munition lastMunition fireCount maxCount)
      (setq maxCount (typGetStaticData (itmGetUnid gItem) 'TotalShots))
      (if (not maxCount) (setq maxCount 1))
      (setq fireCount (itmGetData gItem "fireCount"))
      (setq ammolist (itmGetData gItem "ammolist"))
      (setq launcher (typGetStaticData (itmGetUnid gItem) 'VirtualLauncher))
      (setq lastMunition (objGetitemData gSource gItem "lastMunition"))
      (if (or (not fireCount) (gr fireCount maxCount))
         (setq fireCount 1)
      )
      ; determine ammo type
      (if (eq 1 fireCount)
         (enum ammolist ammo
            (if (not munition)
               (if (objHasItem gSource (itmCreate ammo 1))
                  (setq munition ammo)
               )
            )
         )
         (setq munition lastMunition)
      )
      (if munition
         (block nil
            (setq speed (typGetDataField munition "speed"))
            (if (if (eq 1 fireCount) (objRemoveItem gSource (itmCreate munition 1)) True)
               (block nil
                  (setq shot (sysCreateWeaponFire munition gSource aFirePos aFireAngle speed aTargetObj nil aWeaponBonus))
                  (objIncVel shot (objGetVel gSource))
               )
            )
         )
         ;; else don't fire!
      )
      (objsetitemData gSource gItem "fireCount" (add 1 fireCount))
      (objsetitemData gSource gItem "lastMunition" munition)
      true
   )
))


I'm currently using objsetdata and objgetdata with name mangling as a substitute and that does work, which demonstrates that the statements are being executed.

The only thing I can think of to explain this is that objsetitemdata silently fails if more than two keys are placed on an item. Whyever this is failing it is doing so silently. This is bad.

I don't have the time to set up a better test case right now since I'm in the middle of a rats nest of interlocking bugs.

_________________
Literally is the new Figuratively


Thu Mar 08, 2012 1:53 am
Profile
Fleet Officer
Fleet Officer

Joined: Wed Jan 14, 2009 3:08 am
Posts: 1651
Location: Enslaved by the Iocrym
Post Re: objsetitemdata and itmgetdata problem
It's the same problem as the one we had earlier (in the unlauncher iirc). objSetItemData returns a new item struct. So i am pretty certain that the second time through, you are not setting data on the same item.

_________________
Get your own Galactic Omni Device
Get it now. It's free!!
Image


Thu Mar 08, 2012 4:26 pm
Profile
Militia Commander
Militia Commander
User avatar

Joined: Sun Nov 07, 2010 10:20 pm
Posts: 311
Location: . . . between the stars and the warm black sky . . .
Post Re: objsetitemdata and itmgetdata problem
I recently filed a ticket which may be relevant to your interests: http://wiki.neurohack.com/transcendence/trac/ticket/802

_________________
Image
Image
Image


Tue Jun 05, 2012 1:05 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.