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 11-29-2006, 10:07 PM   #16
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

I don't really understand what you mean by "support dynamic arrays"

The rest are all bugs. Let me check
---
Edit: I just tested both examples and no syntax errors, are you using latest version? Maybe there's something else involved causing the issue.
__________________
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
Sponsored Links - Login to hide this ad!
Old 11-30-2006, 01:26 AM   #17
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

You right, i forgot to update to the latest version, thanks alot.
BlinkBoy is offline   Reply With Quote
Old 11-30-2006, 02:01 AM   #18
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

so, what did you mean by the dynamic array support?
__________________
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 12-07-2006, 02:56 PM
Vexorian
This message has been deleted by Vexorian. Reason: ...
Old 12-16-2006, 02:11 PM   #19
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

0.9.4 is up, a lot of new features:

methods


Collapse JASS:
struct Vector
    real x=0
    real y=0
    real z=0

    // sorry, no syntax for actual constructors, you can always make dummy ones though...
    static method create_from takes real x, real y, real z returns Vector
     local Vector n=Vector.create()
        set n.x=x
        set n.y=y
        set n.z=z
     return n
    endmethod

    method magnitude takes nothing returns real
        return SquareRoot( this.x*this.x + this.y*this.y + this.z*this.z)
    endmethod

    // this is necessary, it was easier to code but it also removes ambiguousness
    // and enforces to notice that it is a whole access and not just 'normal' var usage
    method plus takes Vector B returns nothing
        set this.x=this.x+B.x
        set this.y=this.y+B.y
        set this.z=this.z+B.z
    endmethod

    // yeah, static methods...
    static method addition takes Vector A, Vector B returns Vector
     local Vector C=Vector.create()
        set C.x=A.x+B.x
        set C.y=A.y+B.y
        set C.z=A.z+B.z
     return C
    endmethod

    // onDestroy is called when .destroy() is used
    method onDestroy takes nothing returns nothing
     local code c=(function Vector.err)

        call BJDebugMsg("Funny, the vector was destroyed")
    endmethod

endstruct

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing

 local Vector A=Vector.create_from(4.5,3.4,2.1)
    call BJDebugMsg(R2S(A.magnitude()))

    call Vector.destroy(A)
    call Vector.destroy(A) //double free is now prevented!

endfunction




Polymorphism (interfaces)

Collapse JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
 local expression e= sum.createFrom( sum.createFrom( value.createFrom(8),  sum.createFrom(value.createFrom(2),value.createFrom(-1)) ) , value.createFrom(12) )
 local sum e2
 local sum e3
 local integer i=1000

    call BJDebugMsg(I2S(e.evaluate()))
    call e.destroy()
    set e2=sum.createFrom(value.createFrom(1) ,  value.createFrom(1) )
    loop
        exitwhen i==0
        set e2.a = sum.createFrom( value.createFrom(1) , e2.a)
        set i=i-1
    endloop

call TriggerSleepAction(0.)
    call BJDebugMsg(I2S(e2.evaluate()))
    call BJDebugMsg(I2S(e2))
    call e2.destroy()



endfunction

interface expression
    method evaluate takes nothing returns integer
endinterface


struct value extends expression
    integer v=0

    static method createFrom takes integer v returns value
     local value o=value.create()
        set o.v=v
     return o
    endmethod

    method evaluate takes nothing returns integer
     local value x=this
        return this.v
    endmethod
endstruct


struct sum extends expression
    expression a = 0
    expression b = 0

    static method createFrom takes expression a, expression b returns sum
     local sum o= sum.create()
        set o.a=a
        set o.b=b
     return o
    endmethod



    method evaluate takes nothing returns integer
        return this.a.evaluate() + this.b.evaluate()
    endmethod

    method onDestroy takes nothing returns nothing
        if(this.a!=0) then
            call this.a.destroy()
        endif
        if(this.b!=0) then
            call this.b.destroy()
        endif
    endmethod

endstruct



Methods are not like normal functions:
- You can call methods from every position of the script without problems
- In exchange, it is not a good idea to have waits or GetTriggeringTrigger() inside methods.


An involuntary feature is that static methods that take nothing can actually be used as code values (function class.method) !


inject


Collapse JASS:

//! inject main
     call BJDebugMsg("Look! I just replaced the map's main function")

     //! dovjassinit
     // (always required, structs and libraries need some initializing)

//! endinject



//! inject config

    // injecting config really needs to setup players and stuff really well otherwise it crashes.

//! endinject

//These things were requested by IceFrog and I kind of liked the idea...



--

The grimoire pack and the documentation for 0.9.4 features might take some time.

---
BTW you 'can' use a single . inside methods so this or classname are implicit but I don't really like this.

For example, in the above sample it could be: set .x = .x + B.y
__________________
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 12-16-2006, 04:23 PM   #20
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

Quote:
Originally Posted by Vexorian
so, what did you mean by the dynamic array support?

Nah forget it, the problem was that in my old problem, I had to declare arrays iten by iten and not use a loop that can change Ā«making a dynamic array. I think I'll explain myself.

In other languages such as in Visual Basic, there are 2 types of arrays Static and Dynamic. Static Arrays in VB have a limited amount of spaces, example:\
Code:
Dim D(8) as Double
this means that the array will be limited to store 9 variables 0 to 8. In the other hand dynamic arrays were subjected to the system limits, so you declared them by not adding any value between the (). That was why I got confused.

Anyways a good suggestion would be multidimensional arrays, It would be better for administrating your information a jass syntax example could be:

Collapse JASS:
globals
        real array dim(2) MyArray
endglobals

function MyFunction takes real b, real c, real a, real index returns nothing
set real k = SquareRoot( (b*b) - (4*a*c))
set MyArray[index,1] = (k - b) / (2*a)
set MyArray[index,2] = ((-1)*k - b) / (2*a)
// I know that I can use an sruct for this, but it would be problematic if I would like to make my code more flexible
endfunction

I'm 100% sure you already know all this, but just as a reference, It would be nice if you could add that, maybe my example is not the best one to reffer to this, but i'm sure it is usefull.
BlinkBoy is offline   Reply With Quote
Old 12-16-2006, 06:12 PM   #21
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

I am still limited by JASS' own limitations, in JASS all arrays take 8192 , nd arrays could happen I am not sure if after coding all the . non-sense for structs I have the intenrion of going crazy on parsing [] variations o_O
__________________
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 12-16-2006, 06:34 PM   #22
wyrmlord
User
 
wyrmlord's Avatar
 
Join Date: Feb 2006
Posts: 399

Submissions (2)

wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)

Default

If you wanted to create a multi-dimensional array, you'd have to put a limit on how large each index could be. For instance, if you had a limit of 90 for each index in a two dimensional array, it would work. If you had a limit of 20 for each index, you could have a 3 dimensional array. There's no "real" way to do multi-dimensional arrays in JASS.

Also, the struct idea is giving me an idea on how to make a system to store/retrieve values that would be faster than gamecache. You have a node struct, like in a linked list. That node contains 3 variables, one is an integer, representing the 'key' you store a value under, one is whatever value is being stored (I'm going to like text macros), and the third is another node. To store a value, you give the function a key (meant to be the integer version of a handle). The function would then keep going to the next node over and over again until it either found that key (from a previous use) or an empty spot, where it would then create a new node and store the information there. The only thing is, I'm wondering if this would work and not bug.
__________________
A member of Clan TDG - Quality mapmaking and playtesting.

Tired of boring old GUI? Want to learn JASS? Take a look at these tutorials.

Last edited by wyrmlord : 12-16-2006 at 09:19 PM.
wyrmlord is offline   Reply With Quote
Old 12-17-2006, 03:21 AM   #23
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

Hmm, yap maybe 1 array is not complecent for multidimensional needs.

Btw to wyrmlord, that system wouldn't save much processing, since you still depend of the safecasting [example: H2I], which is the function that makes processing a bit longer.

Last edited by BlinkBoy : 12-17-2006 at 03:53 AM.
BlinkBoy is offline   Reply With Quote
Old 12-17-2006, 03:28 AM   #24
wyrmlord
User
 
wyrmlord's Avatar
 
Join Date: Feb 2006
Posts: 399

Submissions (2)

wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)

Default

Actually, the way that my code works, I don't need to store it as an integer, I can store it using a handle or w/e actually. If you're interested in seeing the code just ask.

Suggestion for the program: Variable array support in structs.
__________________
A member of Clan TDG - Quality mapmaking and playtesting.

Tired of boring old GUI? Want to learn JASS? Take a look at these tutorials.
wyrmlord is offline   Reply With Quote
Old 12-17-2006, 03:53 AM   #25
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

Hey I know one, how about the old Select Case? is not as confusing as having many elseif.

Collapse JASS:
globals
        constant integer NullTeam = 3
endglobals

function GetPlayerTeamIDtakes player p returns integer
select case GetPlayerID(p) // takes a value

         case  this < 7
                 return 1
         case 7 < this and this < 13
                 return 2
         case else
                 return NullTeam
endselect
endfunction

// another form, a function that identifies a pair of numbers between 1 to 10

function IsPair takes integer i returns boolean
select case i

         case  2, 4, 6, 8, 10
                 return true
         case 1, 3, 5, 7, 9
                 return false
         case else
                 return false
endselect
endfunction

struct longitud
         real value 0
         string scale = "miles"
endstruct

//Now a practical one.
function ConvLongitud takes longitud l, string newscale takes returns nothing
if l.scale = "miles" then
    select case newscale
         case  "feet"
                 set l.scale = "feet"
                 set l.value = 5280 * l.value
         case "yards"
                 set l.scale = "yards"
                 set l.value = 1760 * l.value
         case "inches"
                 set l.scale = "inches"
                 set l.value = 63360 * l.value
    endselect
elseif l.scale = "feet" then
//.... and so on and so on.
endif
endfunction      

Anyways, could you show me the code?, wyrm

Last edited by BlinkBoy : 12-17-2006 at 03:54 AM.
BlinkBoy is offline   Reply With Quote
Old 12-17-2006, 10:29 AM   #26
BertTheJasser
xyzi - our universe
 
BertTheJasser's Avatar
 
Join Date: May 2005
Posts: 742

Submissions (2)

BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)

Default

Collapse JASS:
set k=0.03/lumen[i].fade
give s me compile errors (grimoire, JassHelper 0.9.3), where lumen is a struct.
But
Collapse JASS:
set k=lumen[i].fade
set k=0.03/k
works as supposed, wihout errors.
__________________
Note: Bye... I had a lot of fun here!
Special thanks to Vexorian who helped me learn jass, the real jass and always helped me when problems occured, I would call him somehow my mentor. Pipedream, who made amazing Grimoire and helped me acclerating my map (currently at 99% finished, no developement atm).

Vote for Linux Ports in general of Blizzard products: http://www.PetitionOnline.com/ibpfl/

Last edited by BertTheJasser : 12-17-2006 at 10:32 AM.
BertTheJasser is offline   Reply With Quote
Old 12-17-2006, 12:37 PM   #27
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

So have you tested in 0.9.4?.


Blinkboy: I think case would be quite useless a.k.a the code would still be as slow or even allow the user to create really slow code

Edit: A similar code in 0.9.4 doesn't seem to cause errors
__________________
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 12-19-2006, 12:10 PM   #28
Ragnarok X
User
 
Join Date: Dec 2003
Posts: 83

Ragnarok X has little to show at this moment (5)

Default

Why always the WEHelper internal preprocessor "define" get executed after your JassHelper preprocessor even if i put the define preprocessor before your own.

The main problem is that i want to remplace public or private variables and function with the define, but i cann't, or maybe you can with another preprocessador?.
Ragnarok X is offline   Reply With Quote
Old 12-19-2006, 12:14 PM   #29
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

It is a necessary evil
__________________
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 12-19-2006, 09:02 PM   #30
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

0.9.4 has put the fun back into JASS for me. It's easy to get fancy with data structures, although you have to do everything with lists and trees. Essentially it accomplishes the dynamic allocation/array passing dream in a manner far more practical than DARY.

It would be cool to have some type safety/casting, I keep mixing up structures.
__________________
PipeDream 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 07:09 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