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 > Warcraft III Modding > Developer's Corner > Warcraft Editing Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-06-2009, 11:36 PM   #1501
PurplePoot
User


Official Map Reviewer
 
Join Date: Jan 2006
Posts: 363

PurplePoot will become famous soon enough (60)PurplePoot will become famous soon enough (60)PurplePoot will become famous soon enough (60)

Default

Any chance of getting enums?

Collapse JASS:
enum itemType
    weapon, //ends up with value 0
    armour, //ends up with value 1
    shield, //ends up with value 2
    helmet=4, //ends up with value 4
    offhand=2, //ends up with value 2
    ring //ends up with value 3
endenum

..

function f takes itemType it returns nothing
    if it == weapon then
    elseif it == armour then
    //etc
    endif
endfunction

function a takes nothing returns nothing
    local itemType it = weapon
    call f(it)
endfunction

function blah takes nothing returns nothing
    call f(itemType.weapon) //or something
endfunction

Or something similar.

Last edited by PurplePoot : 04-06-2009 at 11:38 PM.
PurplePoot is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-07-2009, 12:20 AM   #1502
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

my idea for enums was itemType.weapon , itemType.armour, but not doing them without it. Mah, I might actually do it, for the next version.
__________________
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 04-07-2009, 01:37 AM   #1503
PurplePoot
User


Official Map Reviewer
 
Join Date: Jan 2006
Posts: 363

PurplePoot will become famous soon enough (60)PurplePoot will become famous soon enough (60)PurplePoot will become famous soon enough (60)

Default

Eh, it kind of defeats the purpose to just have itemType.x... then it basically just becomes a struct with only static members (and is ugly).
PurplePoot is offline   Reply With Quote
Old 04-07-2009, 03:02 AM   #1504
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Well, the real purpose with enums is type safety and auto assignation of values. Many languages out there use that syntax for enums and I like it because it looks less ugly, with the alternative you'll most likely end up doing item_type_artifact for the enum's name...
__________________
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 04-07-2009, 12:53 PM   #1505
FriendlyPsycho
User
 
FriendlyPsycho's Avatar
 
Join Date: Feb 2009
Posts: 109

Submissions (1)

FriendlyPsycho is on a distinguished road (12)

Default

Can I ask when the next update is going to be released? I can't test some things because of the compile errors with interfaces and I don't have any older version of jasshelper.
__________________
" YOU RAGE, YOU LOSE! "
FriendlyPsycho is offline   Reply With Quote
Old 04-07-2009, 02:31 PM   #1506
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Not sure, I was planning releasing it today, but yesterday some homework about email protocols got way too esoteric and consumed all my time, who knows what would happen today.
__________________
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 04-07-2009, 03:41 PM   #1507
gekko
User
 
gekko's Avatar
 
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)

Default

I would also like those enums for type safety!
But surely WITH the prefix. Without it, it really looks ugly and there may be name conflicts if two enums got the same members (and I have some maps where this would already be the case).
gekko is offline   Reply With Quote
Old 04-07-2009, 10:29 PM   #1508
Barade
User
 
Barade's Avatar
 
Join Date: May 2006
Posts: 163

Barade is on a distinguished road (14)

Default

Maybe a new bug report:
Collapse JASS:
//Inventory is a struct
//playerInventory is a static array member with type Inventory

//Error
set Inventory.playerInventory = Inventory.create(user)

//No error
set Inventory.playerInventory[i] = Inventory.create(user)

I hope it will be possible to define function interfaces in structs in one of the next releases. Would be useful because I do not have private access at the moment therefore I always have to call a method :-(.
Attached Images
File Type: png Unbenannt.PNG (6.4 KB, 26 views)
__________________

Last edited by Barade : 04-07-2009 at 10:32 PM.
Barade is offline   Reply With Quote
Old 04-08-2009, 12:02 AM   #1509
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

You can't assign to static array members (as they are actually jass arrays)

Edit: Ah, so the error is an access violation, will fix.
__________________
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 04-10-2009, 09:15 AM   #1510
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

Bug report:

Collapse JASS:
globals
    constant integer Size = 24573
endglobals

struct SomeStruct [Size]

endstruct

Doesn't work when you have Size set to a variable, the value needs to be entered directly or it has no effect. This is pretty bad for systems.
grim001 is offline   Reply With Quote
Old 04-10-2009, 12:17 PM   #1511
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

hmnn, that for sure used to work, very strange
__________________
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 04-10-2009, 07:58 PM   #1512
MindWorX
Level 1 Neothelid


Tools Moderator
 
Join Date: Mar 2004
Posts: 254

Submissions (2)

MindWorX has a spectacular aura about (147)

Default

Have you planned overloading =?
Collapse JASS:
struct vector
    real x
    real y
    real z
    
    method operator = takes nothing returns vector
     local vector newvec = vector.create()
        set newvec.x = this.x
        set newvec.y = this.y
        set newvec.z = this.z
        return newvec
    endmethod
endstruct

function foo takes nothing returns nothing
 local vector vec1 = vector.create()
 local vector vec2
    set vec1.x = 2.
    set vec1.y = 3.
    set vec1.z = 1.
    set vec2 = vec1 //vec2 now holds the data of vec1, but changing the data wont change vec1.
endfunction

Also, do you have any plans for adding methods to native types like handle and integer?
Collapse JASS:
struct handle
    method toInt takes nothing returns integer
        return H2I(this)
    endmethod
endstruct

struct integer
    method toString takes nothing returns string
        return I2S(this)
    endmethod
endstruct

function foo takes nothing returns nothing
 local unit u = CreateUnit(Player(0), 'hfoo', 0., 0., 0.)
    call BJDebugMsg(u.toInt().toString())
endfunction
MindWorX is offline   Reply With Quote
Old 04-10-2009, 08:02 PM   #1513
TriggerHappy
 
Join Date: Feb 2008
Posts: 404

Submissions (2)

TriggerHappy will become famous soon enough (43)TriggerHappy will become famous soon enough (43)

Default

Reminds me of C#.

call BJDebugMsg(u.toInt().toString())
TriggerHappy is offline   Reply With Quote
Old 04-10-2009, 08:12 PM   #1514
Seshiro
User
 
Seshiro's Avatar
 
Join Date: Aug 2008
Posts: 158

Submissions (1)

Seshiro is on a distinguished road (20)

Default

I asked him a few months ago the same^^
But he said no... ;(
Seshiro is offline   Reply With Quote
Old 04-10-2009, 08:12 PM   #1515
MindWorX
Level 1 Neothelid


Tools Moderator
 
Join Date: Mar 2004
Posts: 254

Submissions (2)

MindWorX has a spectacular aura about (147)

Default

Quote:
Originally Posted by TriggerHappy187
Reminds me of C#.

call BJDebugMsg(u.toInt().toString())
Shh, don't say that, vex don't like us comparing vJass to C#!

Quote:
Originally Posted by Seshiro
I asked him a few months ago the same^^
But he said no... ;(
I bet you didn't ask him as nicely as i did.

Last edited by MindWorX : 04-10-2009 at 08:14 PM.
MindWorX 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 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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