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 > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-15-2007, 10:52 AM   #1
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Exclamation Dynamic Array Reals Bug

So, I have this spell. It's rather simple; it shoots a fireball in target direction stunning the first unit it runs into. The only problem is that it doesn't work right in any shape or form.

I originally tested the map with code like this:
Expand JASS:
I cast the spell and nothing happened. The fireball showed up for a split second (the fireball is a dummy unit) and then disappeared. I thought that was odd, so I added in some debug messages:
Expand JASS:
And the game told me that the new X was something like 5912095214521319320000000000000000000000000000. Weird. So I added more debug messages:
Expand JASS:
And it told me this:
Zoom (requires log in)
Essentially saying that 296.00 + (15.50*0.996) = 13194142720000.000 and that -671.750 + (15.50*-0.091) = -46168832000000000000.000.

Being thus flummoxed, I decided to add in a new layer of checking:
Expand JASS:

Once again, this code compiled fine and neither the World Editor nor my janky Syntax Checker gave me an error. However, the numbers still persist. On the first cast, the Y values do not increase randomly, but the X's do. The values are not so large (only around 216231500), yet they do not cause the map to crash... which is weird because it's definitely trying to set the X to outside the map bounds (this normally causes a crash).

On the second cast of the spell, the X's are rougly 5912500000000000000000000000000000000 and the game immediately crashes.


Who's got any idea as to why? I know nothing is screwing with this spell because there are only 2 triggers on the map. One is this spell trigger and the other one has only one action: Custom script: call BJDebugMsg(" ").

I invite you to try it out.
Attached Images
File Type: jpg Picture 5.jpg (56.9 KB, 120 views)
Attached Files
File Type: w3x Fireball.w3x (135.3 KB, 11 views)
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

Last edited by Pyrogasm : 10-15-2007 at 10:58 AM.
Pyrogasm is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-15-2007, 11:53 AM   #2
Hitchhiker
User
 
Hitchhiker's Avatar
 
Join Date: Aug 2003
Posts: 22

Hitchhiker is on a distinguished road (13)

Default

Collapse JASS:
function Fireball_Callback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    local real X
    local real Y
    local real Offset
    local unit Dummy = GetArrayUnit(ArrayIndex, 3)
    local boolean OutOfBounds = false
    local group G
    local unit U3
    local unit CastDummy
    local integer DummyAbilityId
    local integer Level

    local real cos
    local real sin
    
    call BJDebugMsg("Callback Index: "+I2S(ArrayIndex))

    if GetWidgetLife(Dummy) > 0.405 then
        call BJDebugMsg("Then; Life: "+R2S(GetWidgetLife(Dummy)))
        set Level = GetArrayInt(ArrayIndex, 5)
        set Offset = Fireball_DistancePerInterval(Level)

        set X = GetUnitX(Dummy)
        set Y = GetUnitY(Dummy)
        set cos = GetArrayReal(ArrayIndex, 1)
        set sin = GetArrayReal(ArrayIndex, 2)
        call BJDebugMsg("Old X: "+R2S(X))
        call BJDebugMsg("Old Y: "+R2S(Y))
        call BJDebugMsg("Offset: "+R2S(Offset))
        call BJDebugMsg("MoveCos: "+R2S(cos))
        call BJDebugMsg("MoveSin: "+R2S(sin))
        set X = X+Offset*cos
        set Y = Y+Offset*sin
        call BJDebugMsg("New X: "+R2S(X))
        call BJDebugMsg("New Y: "+R2S(Y))

//        if X < GetRectMinX(bj_mapInitialPlayableArea) then
//            call BJDebugMsg("Set OutOfBounds 1")
//            set OutOfBounds = true
//        elseif X > GetRectMaxX(bj_mapInitialPlayableArea) then
//            call BJDebugMsg("Set OutOfBounds 2")
//            set OutOfBounds = true
//        elseif Y < GetRectMinY(bj_mapInitialPlayableArea) then
//            call BJDebugMsg("Set OutOfBounds 3")
//            set OutOfBounds = true
//        elseif Y > GetRectMaxY(bj_mapInitialPlayableArea) then
//            call BJDebugMsg("Set OutOfBounds 4")
//            set OutOfBounds = true
//        endif

        if not(OutOfBounds) then
            call BJDebugMsg("Not Out of Bounds")

            call SetUnitX(Dummy, X)
            call SetUnitY(Dummy, Y)

            set G = GetArrayGroup(ArrayIndex, 4)
            set bj_stockPickedItemLevel = Level
            set bj_forceRandomCurrentPick = GetOwningPlayer(Dummy)
            call GroupEnumUnitsInRange(G, X, Y, Fireball_CollisionRadius(Level), Condition(function Fireball_Filter))

            set U3 = FirstOfGroup(G)
            if U3 != null then
                call BJDebugMsg("Collision")
                set DummyAbilityId = Fireball_DummyStunSpellId(Level)
                set CastDummy = CreateUnit(bj_forceRandomCurrentPick, Fireball_DummyUnitId(), X, Y, 0.00)
                call UnitAddAbility(CastDummy, DummyAbilityId)
                call SetUnitAbilityLevel(CastDummy, DummyAbilityId, Level)
                call IssueTargetOrder(CastDummy, Fireball_DummyStunSpellOrderString(Level), U3)
                call UnitApplyTimedLife(CastDummy, 'BTLF', 2.00)

                call DestroyEffect(AddSpecialEffect(Fireball_CollideEffectPath(Level), X, Y))
                call KillUnit(Dummy)
                set CastDummy = null
                set U3 = null
            endif

        else
            call BJDebugMsg("Out of Bounds")
            call KillUnit(Dummy)
        endif
    else
        call BJDebugMsg("Else; Life: "+R2S(GetWidgetLife(Dummy)))
        call DestroyGroup(GetArrayGroup(ArrayIndex, 4))
        call DestroyArray(ArrayIndex)
        call PauseTimer(T)
        call DestroyTimer(T)
    endif

    set T = null
    set Dummy = null
endfunction
setting cos/sin first to a variable worked for me
__________________
42.
Hitchhiker is offline   Reply With Quote
Old 10-15-2007, 01:20 PM   #3
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

That would have to do with the 'having to set reals to a variable before return bugging them' thing.

Edit: Just by the way, your thread title is incredibly misleading as this has nothing to do with integers or the max size of them.
__________________

Last edited by blu_da_noob : 10-15-2007 at 01:21 PM.
blu_da_noob is offline   Reply With Quote
Old 10-15-2007, 02:47 PM   #4
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

Looks like integer 2 real got the same bugs as real 2 intger.

Collapse JASS:
    //===================================================================================================
    // Indexes of real types
    //
    function SetArrayReal takes integer id, integer index, real val returns nothing
        set index=id+index
        if (index<8191) then
            set cs_array1[index]=CS_r2i(val)
        elseif (index<16382) then    
            set cs_array2[index-8191]=CS_r2i(val)
        else
            call StoreReal(cs_cache,I2S(-id),I2S(index),val)
        endif
    endfunction
    function GetArrayReal takes integer id, integer index returns real
     local real r
        set index=id+index
        if (index<8191) then
            set r= CS_i2r(cs_array1[index])
        elseif (index<16382) then    
            set r= CS_i2r( cs_array2[index-8191] )
        else
            set r=GetStoredReal(cs_cache,I2S(-id),I2S(index))
        endif
     return r
    endfunction

If you ask me, people shouldn't really be using cscache's dynamic arrays... At least not on things that are not integers.
__________________
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-15-2007, 06:29 PM   #5
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Question: if you're using new gen, why don't you use constant globals instead of all those constant functions? It would save you some space (and will also spare you of that annoying "()" typing)
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 10-15-2007, 06:59 PM   #6
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

Quote:
if you're using new gen
He isn't.
__________________
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-15-2007, 08:14 PM   #7
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Well, I said that I broke the integer limit because I thought the max integer was something like 2235901257012 and I was getting numbers bigger than that which weren't causing the game to crash.


Is it really a bad idea to use Dynamic Arrays for spells, Vexorian? I thought it would be smarter because it avoids gamecache lookup and they aren't permanently taking up space for available indexes.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-16-2007, 12:58 AM   #8
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Whoo. Double post.

I've fixed the random fuckups with the dynamic arrays' reals and encountered another problem: the spell itself works fine, no errors or anything and all the effects happen as they should.

The problem arises when the same unit casts the spell once and then once more again whilst the first fireball is still in existence. If this happens, the game immediately crashes.

I thought I would try it with two different units casting the spell at the same time to see if it caused a crash, and it turns out that it does not; instead, something far weirder happens. The first timer simply stops running. After both instances have finished, both units can once again cast as normal (though still not at the same time)... but the value of ArrayIndex increases each time.

Normally, the text "Callback ArrayIndex: 2" shows up during the spells, but after doing the above, the message "Callback ArrayIndex: 7" is displayed instead. My guess is that this is because the first array (of which 5 slots are used) is not being destroyed when the timer stops running. Of his, however, I am not sure.

Here's the spell code:
Expand JASS:
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

Last edited by Pyrogasm : 10-16-2007 at 12:59 AM.
Pyrogasm is offline   Reply With Quote
Old 10-16-2007, 03:52 AM   #9
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

Quote:
Originally Posted by Pyrogasm
Well, I said that I broke the integer limit because I thought the max integer was something like 2235901257012 and I was getting numbers bigger than that which weren't causing the game to crash.


Is it really a bad idea to use Dynamic Arrays for spells, Vexorian? I thought it would be smarter because it avoids gamecache lookup and they aren't permanently taking up space for available indexes.
It barely fixes gamecache's speed issue but it doesn't deal with the other one, i2u.

I think though that it might be possible to fix it, I dunno.
__________________
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-16-2007, 04:29 AM   #10
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

So how is it worse than gamecache? Storing/getting things using AttachObject(...) and GetAttachedUnit(...) still uses I2U.


No ideas on the current issue? One thing I forgot to mention is that I commented out the SetUnitX/Y lines to try to eliminate the crash there but to no avail... so it definitely isn't that.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-16-2007, 10:58 AM   #11
Hitchhiker
User
 
Hitchhiker's Avatar
 
Join Date: Aug 2003
Posts: 22

Hitchhiker is on a distinguished road (13)

Default

seems that local unit Dummy = GetArrayUnit(ArrayIndex, 3) is failing when cast 2 times at the same time.
Collapse JASS:
function Fireball_Callback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    //local real X
    //local real Y
    //local real Offset
    local unit Dummy = GetArrayUnit(ArrayIndex, 3)
    // ... only comments here
crashes whereas
Collapse JASS:
function Fireball_Callback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    //local real X
    //local real Y
    //local real Offset
    //local unit Dummy = GetArrayUnit(ArrayIndex, 3)
    // ... only comments here
is not.
__________________
42.
Hitchhiker is offline   Reply With Quote
Old 10-17-2007, 02:51 AM   #12
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Dumb. It turns out I accidentally deleted the trigger that initialized CSCache at some point or another.

Stupidest mistake I've made in a long time.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-17-2007, 02:23 PM   #13
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

Quote:
Originally Posted by Pyrogasm
So how is it worse than gamecache? Storing/getting things using AttachObject(...) and GetAttachedUnit(...) still uses I2U.


No ideas on the current issue? One thing I forgot to mention is that I commented out the SetUnitX/Y lines to try to eliminate the crash there but to no avail... so it definitely isn't that.
It's better than gamecache but it is not much better.
__________________
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
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 05:57 PM.


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

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