wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-23-2009, 11:34 AM   #16
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Hey, I might use this soon, here are some suggestions for the module...
  • In method operator [], just call allocate() instead of create. This means you can declare your own create method in implementing structs.
  • You can overwrite destroy now, so you can port the release method to destroy. This will also fix the issue with onDestroy not working with thatItem
  • thatItem is kind of awkward sounding and long, I suggest renaming it to "it", short for item but also sounds like something you would use to refer to an object.

I wonder if anyone currently uses this... probably not, so who cares about breaking reverse compatibility.
grim001 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-23-2009, 12:53 PM   #17
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

I'll also make it a single library with a constant to make it choose between Table or ItemUserData

Quote:
In method operator [], just call allocate() instead of create. This means you can declare your own create method in implementing structs
Actually, my idea was that you could make Itemdex call .create so you can init stuff that can't be init with .allocate

it is not descriptive enough for me to use it there.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 10-23-2009, 01:53 PM   #18
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by Vexorian
I'll also make it a single library with a constant to make it choose between Table or ItemUserData
Maybe I should do the same thing with AutoIndex, hmmn...

Quote:
Originally Posted by Vexorian
Actually, my idea was that you could make Itemdex call .create so you can init stuff that can't be init with .allocate
OK, passing parameters to create with Itemdex structs doesn't seem important anyway.

Quote:
Originally Posted by Vexorian
it is not descriptive enough for me to use it there.
Itemdex makes the struct instance essentially belong to an item, so "me" could make sense. Nothing else that's short makes any sense. I don't care too much though.
grim001 is offline   Reply With Quote
Old 10-23-2009, 08:25 PM   #19
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

All right then updated.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 11-28-2009, 10:58 AM   #20
Gamat
User
 
Gamat's Avatar
 
Join Date: Aug 2008
Posts: 40

Gamat has little to show at this moment (2)

Default

How can i get the item in the module's create method?

Collapse JASS:
static method create takes nothing returns nothing
local integer id = GetItemTypeId(????)
endmethod
Gamat is offline   Reply With Quote
Old 11-28-2009, 04:23 PM   #21
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

It is kind of annoying that GetItemId returns non-0 values for null items. Even worse it allocates a new ID every time.
grim001 is offline   Reply With Quote
Old 12-08-2009, 05:17 AM   #22
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

I thought I would bump this because the aforementioned issue is really bad. Using GetItemId(null) and expecting it to return 0 should be supported.

The method of checking if something is a ghost item is pretty bad, since any item which runs out of charges will die and thus be considered a ghost item. The ghost item check should only apply to powerup items in order to avoid printing the error for regular items that run out of charges.

Also, this script fails to compile if [forcemethodevaluate] is turned on. In the module, destroy() is called from above its declaration.

Last edited by grim001 : 12-08-2009 at 05:24 AM.
grim001 is offline   Reply With Quote
Old 02-25-2010, 09:53 AM   #23
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

I'm not sure what im doing wrong, but when i tried to use this script its giving me an error
saying libraries cannot require scopes at this line:

"library Itemdex initializer init requires optional Table"

any idea what might be causing this?

Edit: It seems my Jass does not recognize the optional type/?..

Last edited by sPyRaLz : 02-25-2010 at 10:08 AM.
sPyRaLz is offline   Reply With Quote
Old 02-25-2010, 11:47 AM   #24
Deaod
User
 
Join Date: Jan 2007
Posts: 541

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

It seems you have an outdated version of JassHelper. Just grab the newest version of JassHelper.
__________________
Deaod is offline   Reply With Quote
Old 02-25-2010, 01:47 PM   #25
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

Quote:
Originally Posted by Deaod
It seems you have an outdated version of JassHelper. Just grab the newest version of JassHelper.

Hmm.. i just downloaded and extracted the latest version in Vexorians sig. Extracted it, but im not sure where im supposed to put the files. Maybe i should just redl the NewGen Jass pack and reextract it all.. anyways thanks, will give it a try.
sPyRaLz is offline   Reply With Quote
Old 04-04-2011, 04:06 AM   #26
SanKakU
User
 
Join Date: Jan 2009
Posts: 133

SanKakU has a little shameless behaviour in the past (-1)

Send a message via AIM to SanKakU Send a message via MSN to SanKakU Send a message via Yahoo to SanKakU
Default

Quote:
Originally Posted by grim001
It is kind of annoying that GetItemId returns non-0 values for null items. Even worse it allocates a new ID every time.

i noticed this as well.

why don't we update the system. 3 more lines+comment?

replace
Code:
function GetItemId takes item it returns integer
 local index d
 static if(USE_USER_DATA) then
with
Code:
function GetItemId takes item it returns integer
 local index d
//sankaku adds the if then to avoid indexing blank inventory slots...
 if it==null then
 return 0
 endif
 static if(USE_USER_DATA) then
it seems to be working just fine on my maps.

Last edited by SanKakU : 04-04-2011 at 04:08 AM.
SanKakU is offline   Reply With Quote
Old 04-04-2011, 09:56 AM   #27
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

That kind of safety should only be implemented only if debug mode is turned on. People should check themselves if their item is null.
Bribe is offline   Reply With Quote
Old 04-04-2011, 04:51 PM   #28
SanKakU
User
 
Join Date: Jan 2009
Posts: 133

SanKakU has a little shameless behaviour in the past (-1)

Send a message via AIM to SanKakU Send a message via MSN to SanKakU Send a message via Yahoo to SanKakU
Default

i don't think it should matter if debug mode is on or not. it uses extra function calls to do stuff to null items...which as far as i can tell serves no purpose whatsoever. it also means the more units with inventory you have, the more null items you have.
SanKakU is offline   Reply With Quote
Old 04-05-2011, 05:50 AM   #29
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

I don't see him attempting to access that item without safety.

Collapse JASS:
            if ( this.attachedto != null) then
                set d = GetItemId( this.attachedto)

The only thing I can see is somebody who doesn't know what they're doing calling GetItemId on a null item, in which case it's the user's responsibility to make sure they are passing a correct value (unless in debug-mode).
Bribe is offline   Reply With Quote
Old 04-05-2011, 09:03 PM   #30
SanKakU
User
 
Join Date: Jan 2009
Posts: 133

SanKakU has a little shameless behaviour in the past (-1)

Send a message via AIM to SanKakU Send a message via MSN to SanKakU Send a message via Yahoo to SanKakU
Default

Quote:
Originally Posted by Bribe
I don't see him attempting to access that item without safety.

Collapse JASS:
            if ( this.attachedto != null) then
                set d = GetItemId( this.attachedto)

The only thing I can see is somebody who doesn't know what they're doing calling GetItemId on a null item, in which case it's the user's responsibility to make sure they are passing a correct value (unless in debug-mode).
i don't we're talking about the same thing. if one just selects all 6 itemslots and asks for itemindex numbers for each one of them, he will get relevant numbers for irrelevant itemslots. what's the point of that? that's why i added my if then part to getitemid.

you've been talking about the module of the script, and i don't even know what that is for!
i've been ignoring it and just using getitemid. i told you i tested the script in game and got numbers for blank item slots. which in my mind serves no purpose. it was a very easy fix as far as i could tell.

why would you ever want to waste giving out an index to an item that doesn't exist? you'd be handing out 6 indexes per unit! a huge, monumental waste of indexes.

Last edited by SanKakU : 04-05-2011 at 09:05 PM.
SanKakU is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:26 PM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services