Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Jass Hot Code Reload

Discussion in 'Warcraft Editing Tools' started by LeP, Mar 20, 2019.

  1. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    Code (vJASS):

    // fn has type integer but the expression 'function lep__draw_loop' has type code
    local integer fn= function lep__draw_loop
     


    Don't know if you read my edit above, but it seems to work now (after adding some dummy lines):
    Code (vJASS):

    function bdw_auto_wid_base takes integer base returns nothing
        local integer no_inline_1
        local integer no_inline_2
        set g_Wid[bd_p] = base
    endfunction
     
     
  2. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    That is intentional. Blizzard doesn't want to give us code arrays so i have to adapt.

    I've read it but for me it works without that. Maybe paste the output of your update command with --asm flag.
     
  3. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    with dummy lines
    Code (Text):

    Updating function lep__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2260 lep__draw_loop
    lit integer -2 1 0
    bind integer 1 -2
    call nothing -1 2235 bd_draw_begin
    lit integer -4 4 1000
    bind integer 1 -4
    call nothing -3 2246 bdw_auto_wid_base
    lit integer -5 1 0
    set integer 5 -5
    gga integer -6 20 5
    set integer 6 -6
    lit integer -7 3 320
    set integer 3 -7
    lit integer -8 2 64
    set integer 4 -8
    lit integer -9 1 0
    set integer 1 -9
    lit integer -10 1 0
    set integer 2 -10
    lit string -12 8 click me
    lit integer -13 1 0
    lit integer -14 1 0
    lit integer -15 1 0
    lit integer -16 3 255
    lit integer -17 3 255
    lit integer -18 3 255
    lit integer -19 3 255
    lit integer -20 3 255
    lit boolean -21 5 False
    bind string 1 -12
    bind integer 2 1
    bind integer 3 2
    bind integer 4 3
    bind integer 5 4
    bind integer 6 -13
    bind integer 7 -14
    bind integer 8 -15
    bind integer 9 -16
    bind integer 10 -17
    bind integer 11 -18
    bind integer 12 -19
    bind integer 13 -20
    bind boolean 14 -21
    bind integer 15 6
    call boolean -11 2248 bdw_text_button
    jmpt -11 2
    jmp 3
    label 2
    lit string -23 1 A
    bind string 1 -23
    call nothing -22 1275 BJDebugMsg
    label 3
    call nothing -24 2236 bd_draw_end
    ret nothing
     
    without dummy lines
    Code (Text):

    Updating function lep__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2260 lep__draw_loop
    lit integer -2 1 0
    bind integer 1 -2
    call nothing -1 2235 bd_draw_begin
    gg integer -3 274
    lit integer -4 4 1000
    sga integer 7 -3 -4
    lit integer -5 1 0
    set integer 5 -5
    gga integer -6 20 5
    set integer 6 -6
    lit integer -7 3 320
    set integer 3 -7
    lit integer -8 2 64
    set integer 4 -8
    lit integer -9 1 0
    set integer 1 -9
    lit integer -10 1 0
    set integer 2 -10
    lit string -12 8 click me
    lit integer -13 1 0
    lit integer -14 1 0
    lit integer -15 1 0
    lit integer -16 3 255
    lit integer -17 3 255
    lit integer -18 3 255
    lit integer -19 3 255
    lit integer -20 3 255
    lit boolean -21 5 False
    bind string 1 -12
    bind integer 2 1
    bind integer 3 2
    bind integer 4 3
    bind integer 5 4
    bind integer 6 -13
    bind integer 7 -14
    bind integer 8 -15
    bind integer 9 -16
    bind integer 10 -17
    bind integer 11 -18
    bind integer 12 -19
    bind integer 13 -20
    bind boolean 14 -21
    bind integer 15 6
    call boolean -11 2248 bdw_text_button
    jmpt -11 2
    jmp 3
    label 2
    lit string -23 1 A
    bind string 1 -23
    call nothing -22 1275 BJDebugMsg
    label 3
    call nothing -24 2236 bd_draw_end
    ret nothing
     
    I need to leave soon so won't be able to reply anymore.
     
  4. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    I get wildly different bytecode which makes me assume that you are not testing the same code as i am.
    So that would be nice to change.
     
  5. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,124
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    It should not work due to type mismatch however. Code is not an integer.
     
  6. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    I've attached the exact main.j I used for testing (it only depends on the library files from before).


    At map init time the draw_loop function looks like this:
    Code (vJASS):

    private function draw_loop takes nothing returns nothing
        local integer a
        local integer x
        local integer y
        local integer w
        local integer h
        local integer dx
        local integer dy
        local integer font_size
        local real scale
        local Bd_Mouse m
        local Bd_Mbtn lmb
        local Bd_Mbtn mmb
        local Bd_Mbtn rmb
        local boolean any_changed

        set m = Bd_Mouse(0)
        set lmb = m.lmb
        set mmb = m.mmb
        set rmb = m.rmb

        set font_size = 35

        call bd_draw_begin(0)
        call bdw_auto_wid_base(1000)

        set w = 256
        set h = 64

        set x = -1024
        set y = 768
        set dx = 48
        set dy = -128

        set any_changed = false

        // a lot of commented out lines
        // a lot of commented out lines
        // a lot of commented out lines
        // ...

        call bd_draw_end()
    endfunction
     


    I load the map right after an init (the draw_loop function at this point looks like the above).

    Without changing anything I trigger an update and I get:
    Code (Text):

    Updating function entrypoint__on_chat_input
    Updating function ascii__chr_init
    Updating function ascii__ord_init
    Updating function baddraw__img_list_clear
    Updating function baddraw__cache_string_bytes
    Updating function bdw_slider
    Updating function bdw_vscrollbar
    Updating function unitsliderstuff__delayed_init
    Updating function main
    Writing bytecode
    // many many lines of asm
     
    I trigger an update (again without changing anything) and I get:
    Code (Text):

    Writing bytecode
    Writing state file
    Ok.
    // no asm
     
    Now I uncomment the button and trigger an update:
    Code (vJASS):

        if bdw_text_button("click me", x, y, w, h, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, false, lmb) then
            call writeln("foo")
        endif
     


    I get:
    Code (Text):

    Updating function unitsliderstuff__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2271 unitsliderstuff__draw_loop
    lit integer -1 1 0
    set integer 10 -1
    gga integer -2 20 10
    set integer 11 -2
    gga integer -3 21 10
    set integer 12 -3
    gga integer -4 22 10
    set integer 13 -4
    lit integer -5 2 35
    set integer 8 -5
    lit integer -7 1 0
    bind integer 1 -7
    call nothing -6 2245 bd_draw_begin
    lit integer -9 4 1000
    bind integer 1 -9
    call nothing -8 2256 bdw_auto_wid_base
    lit integer -10 3 256
    set integer 4 -10
    lit integer -11 2 64
    set integer 5 -11
    lit integer -13 4 1024
    neg integer -12 -13
    set integer 2 -12
    lit integer -14 3 768
    set integer 3 -14
    lit integer -15 2 48
    set integer 6 -15
    lit integer -17 3 128
    neg integer -16 -17
    set integer 7 -16
    lit boolean -18 5 False
    set boolean 14 -18
    lit string -20 8 click me
    lit integer -21 1 0
    lit integer -22 1 0
    lit integer -23 1 0
    lit integer -24 3 255
    lit integer -25 3 255
    lit integer -26 3 255
    lit integer -27 3 255
    lit integer -28 3 255
    lit boolean -29 5 False
    bind string 1 -20
    bind integer 2 2
    bind integer 3 3
    bind integer 4 4
    bind integer 5 5
    bind integer 6 -21
    bind integer 7 -22
    bind integer 8 -23
    bind integer 9 -24
    bind integer 10 -25
    bind integer 11 -26
    bind integer 12 -27
    bind integer 13 -28
    bind boolean 14 -29
    bind integer 15 11
    call boolean -19 2258 bdw_text_button
    jmpt -19 2
    jmp 3
    label 2
    lit string -31 3 foo
    bind string 1 -31
    call nothing -30 2269 unitsliderstuff__writeln
    label 3
    call nothing -32 2246 bd_draw_end
    ret nothing
     
    In-game, I can see the button and I can click it (it works, as expected).

    Now I comment out the button and uncomment the first 4 sliders then trigger an update:
    Code (vJASS):

        // if bdw_text_button("click me", x, y, w, h, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, false, lmb) then
        //     call writeln("foo")
        // endif


        set y = y + dy
        call bd_text("R", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(1, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0x00, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("G", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(2, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0xFF, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("B", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(3, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0x00, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("A", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(4, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0xFF, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        if any_changed then
            call SetUnitVertexColor(g_my_unit, bdw_slider_val(1), bdw_slider_val(2), bdw_slider_val(3), bdw_slider_val(4))
        endif
     


    I get:
    Code (Text):

    Updating function unitsliderstuff__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2271 unitsliderstuff__draw_loop
    lit integer -1 1 0
    set integer 10 -1
    gga integer -2 20 10
    set integer 11 -2
    gga integer -3 21 10
    set integer 12 -3
    gga integer -4 22 10
    set integer 13 -4
    lit integer -5 2 35
    set integer 8 -5
    lit integer -7 1 0
    bind integer 1 -7
    call nothing -6 2245 bd_draw_begin
    lit integer -9 4 1000
    bind integer 1 -9
    call nothing -8 2256 bdw_auto_wid_base
    lit integer -10 3 256
    set integer 4 -10
    lit integer -11 2 64
    set integer 5 -11
    lit integer -13 4 1024
    neg integer -12 -13
    set integer 2 -12
    lit integer -14 3 768
    set integer 3 -14
    lit integer -15 2 48
    set integer 6 -15
    lit integer -17 3 128
    neg integer -16 -17
    set integer 7 -16
    lit boolean -18 5 False
    set boolean 14 -18
    add integer -19 3 7
    set integer 3 -19
    lit string -21 1 R
    sub integer -22 2 6
    lit integer -23 3 255
    lit integer -24 3 255
    lit integer -25 3 255
    lit integer -26 3 255
    bind string 1 -21
    bind integer 2 -22
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -23
    bind integer 6 -24
    bind integer 7 -25
    bind integer 8 -26
    call nothing -20 2242 bd_text
    lit integer -28 1 1
    lit integer -29 1 0
    lit integer -30 3 255
    lit integer -31 1 1
    lit integer -32 3 512
    lit integer -33 2 40
    lit integer -34 1 0
    lit integer -35 1 0
    lit integer -36 1 0
    lit integer -37 3 255
    lit integer -38 2 30
    lit integer -39 2 60
    lit integer -40 3 255
    lit integer -41 1 0
    lit integer -42 1 0
    lit integer -43 3 255
    gga integer -44 23 10
    bind integer 1 -28
    bind integer 2 -29
    bind integer 3 -30
    bind integer 4 -31
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -32
    bind integer 8 -33
    bind integer 9 -34
    bind integer 10 -35
    bind integer 11 -36
    bind integer 12 -37
    bind integer 13 -38
    bind integer 14 -39
    bind integer 15 -40
    bind integer 16 -41
    bind integer 17 -42
    bind integer 18 -43
    bind integer 19 11
    bind integer 20 -44
    call boolean -27 2265 bdw_slider
    jmpt -27 2
    jmp 3
    label 2
    lit boolean -45 4 True
    set boolean 14 -45
    label 3
    add integer -46 3 7
    set integer 3 -46
    lit string -48 1 G
    sub integer -49 2 6
    lit integer -50 3 255
    lit integer -51 3 255
    lit integer -52 3 255
    lit integer -53 3 255
    bind string 1 -48
    bind integer 2 -49
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -50
    bind integer 6 -51
    bind integer 7 -52
    bind integer 8 -53
    call nothing -47 2242 bd_text
    lit integer -55 1 2
    lit integer -56 1 0
    lit integer -57 3 255
    lit integer -58 1 1
    lit integer -59 3 512
    lit integer -60 2 40
    lit integer -61 1 0
    lit integer -62 1 0
    lit integer -63 1 0
    lit integer -64 3 255
    lit integer -65 2 30
    lit integer -66 2 60
    lit integer -67 1 0
    lit integer -68 3 255
    lit integer -69 1 0
    lit integer -70 3 255
    gga integer -71 23 10
    bind integer 1 -55
    bind integer 2 -56
    bind integer 3 -57
    bind integer 4 -58
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -59
    bind integer 8 -60
    bind integer 9 -61
    bind integer 10 -62
    bind integer 11 -63
    bind integer 12 -64
    bind integer 13 -65
    bind integer 14 -66
    bind integer 15 -67
    bind integer 16 -68
    bind integer 17 -69
    bind integer 18 -70
    bind integer 19 11
    bind integer 20 -71
    call boolean -54 2265 bdw_slider
    jmpt -54 4
    jmp 5
    label 4
    lit boolean -72 4 True
    set boolean 14 -72
    label 5
    add integer -73 3 7
    set integer 3 -73
    lit string -75 1 B
    sub integer -76 2 6
    lit integer -77 3 255
    lit integer -78 3 255
    lit integer -79 3 255
    lit integer -80 3 255
    bind string 1 -75
    bind integer 2 -76
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -77
    bind integer 6 -78
    bind integer 7 -79
    bind integer 8 -80
    call nothing -74 2242 bd_text
    lit integer -82 1 3
    lit integer -83 1 0
    lit integer -84 3 255
    lit integer -85 1 1
    lit integer -86 3 512
    lit integer -87 2 40
    lit integer -88 1 0
    lit integer -89 1 0
    lit integer -90 1 0
    lit integer -91 3 255
    lit integer -92 2 30
    lit integer -93 2 60
    lit integer -94 1 0
    lit integer -95 1 0
    lit integer -96 3 255
    lit integer -97 3 255
    gga integer -98 23 10
    bind integer 1 -82
    bind integer 2 -83
    bind integer 3 -84
    bind integer 4 -85
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -86
    bind integer 8 -87
    bind integer 9 -88
    bind integer 10 -89
    bind integer 11 -90
    bind integer 12 -91
    bind integer 13 -92
    bind integer 14 -93
    bind integer 15 -94
    bind integer 16 -95
    bind integer 17 -96
    bind integer 18 -97
    bind integer 19 11
    bind integer 20 -98
    call boolean -81 2265 bdw_slider
    jmpt -81 6
    jmp 7
    label 6
    lit boolean -99 4 True
    set boolean 14 -99
    label 7
    add integer -100 3 7
    set integer 3 -100
    lit string -102 1 A
    sub integer -103 2 6
    lit integer -104 3 255
    lit integer -105 3 255
    lit integer -106 3 255
    lit integer -107 3 255
    bind string 1 -102
    bind integer 2 -103
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -104
    bind integer 6 -105
    bind integer 7 -106
    bind integer 8 -107
    call nothing -101 2242 bd_text
    lit integer -109 1 4
    lit integer -110 1 0
    lit integer -111 3 255
    lit integer -112 1 1
    lit integer -113 3 512
    lit integer -114 2 40
    lit integer -115 1 0
    lit integer -116 1 0
    lit integer -117 1 0
    lit integer -118 3 255
    lit integer -119 2 30
    lit integer -120 2 60
    lit integer -121 3 255
    lit integer -122 3 255
    lit integer -123 3 255
    lit integer -124 3 255
    gga integer -125 23 10
    bind integer 1 -109
    bind integer 2 -110
    bind integer 3 -111
    bind integer 4 -112
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -113
    bind integer 8 -114
    bind integer 9 -115
    bind integer 10 -116
    bind integer 11 -117
    bind integer 12 -118
    bind integer 13 -119
    bind integer 14 -120
    bind integer 15 -121
    bind integer 16 -122
    bind integer 17 -123
    bind integer 18 -124
    bind integer 19 11
    bind integer 20 -125
    call boolean -108 2265 bdw_slider
    jmpt -108 8
    jmp 9
    label 8
    lit boolean -126 4 True
    set boolean 14 -126
    label 9
    jmpt 14 10
    jmp 11
    label 10
    gg unit -128 8
    gg hashtable -130 5
    gg integer -131 274
    lit integer -132 1 1
    bind hashtable 1 -130
    bind integer 2 -131
    bind integer 3 -132
    call integer -129 772 LoadInteger
    gg hashtable -134 5
    gg integer -135 274
    lit integer -136 1 2
    bind hashtable 1 -134
    bind integer 2 -135
    bind integer 3 -136
    call integer -133 772 LoadInteger
    gg hashtable -138 5
    gg integer -139 274
    lit integer -140 1 3
    bind hashtable 1 -138
    bind integer 2 -139
    bind integer 3 -140
    call integer -137 772 LoadInteger
    gg hashtable -142 5
    gg integer -143 274
    lit integer -144 1 4
    bind hashtable 1 -142
    bind integer 2 -143
    bind integer 3 -144
    call integer -141 772 LoadInteger
    bind unit 1 -128
    bind integer 2 -129
    bind integer 3 -133
    bind integer 4 -137
    bind integer 5 -141
    call nothing -127 441 SetUnitVertexColor
    label 11
    call nothing -145 2246 bd_draw_end
    ret nothing
     
    In-game, I can still see the button and click on it (I shouldn't because it's commented out) and none of the sliders are visible (but should be).

    Now I uncomment the button and trigger an update:
    Code (vJASS):

        if bdw_text_button("click me", x, y, w, h, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, false, lmb) then
            call writeln("foo")
        endif


        set y = y + dy
        call bd_text("R", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(1, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0x00, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("G", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(2, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0xFF, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("B", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(3, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0x00, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("A", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(4, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0xFF, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        if any_changed then
            call SetUnitVertexColor(g_my_unit, bdw_slider_val(1), bdw_slider_val(2), bdw_slider_val(3), bdw_slider_val(4))
        endif
     


    I get:
    Code (Text):

    Updating function unitsliderstuff__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2271 unitsliderstuff__draw_loop
    lit integer -1 1 0
    set integer 10 -1
    gga integer -2 20 10
    set integer 11 -2
    gga integer -3 21 10
    set integer 12 -3
    gga integer -4 22 10
    set integer 13 -4
    lit integer -5 2 35
    set integer 8 -5
    lit integer -7 1 0
    bind integer 1 -7
    call nothing -6 2245 bd_draw_begin
    lit integer -9 4 1000
    bind integer 1 -9
    call nothing -8 2256 bdw_auto_wid_base
    lit integer -10 3 256
    set integer 4 -10
    lit integer -11 2 64
    set integer 5 -11
    lit integer -13 4 1024
    neg integer -12 -13
    set integer 2 -12
    lit integer -14 3 768
    set integer 3 -14
    lit integer -15 2 48
    set integer 6 -15
    lit integer -17 3 128
    neg integer -16 -17
    set integer 7 -16
    lit boolean -18 5 False
    set boolean 14 -18
    lit string -20 8 click me
    lit integer -21 1 0
    lit integer -22 1 0
    lit integer -23 1 0
    lit integer -24 3 255
    lit integer -25 3 255
    lit integer -26 3 255
    lit integer -27 3 255
    lit integer -28 3 255
    lit boolean -29 5 False
    bind string 1 -20
    bind integer 2 2
    bind integer 3 3
    bind integer 4 4
    bind integer 5 5
    bind integer 6 -21
    bind integer 7 -22
    bind integer 8 -23
    bind integer 9 -24
    bind integer 10 -25
    bind integer 11 -26
    bind integer 12 -27
    bind integer 13 -28
    bind boolean 14 -29
    bind integer 15 11
    call boolean -19 2258 bdw_text_button
    jmpt -19 2
    jmp 3
    label 2
    lit string -31 3 foo
    bind string 1 -31
    call nothing -30 2269 unitsliderstuff__writeln
    label 3
    add integer -32 3 7
    set integer 3 -32
    lit string -34 1 R
    sub integer -35 2 6
    lit integer -36 3 255
    lit integer -37 3 255
    lit integer -38 3 255
    lit integer -39 3 255
    bind string 1 -34
    bind integer 2 -35
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -36
    bind integer 6 -37
    bind integer 7 -38
    bind integer 8 -39
    call nothing -33 2242 bd_text
    lit integer -41 1 1
    lit integer -42 1 0
    lit integer -43 3 255
    lit integer -44 1 1
    lit integer -45 3 512
    lit integer -46 2 40
    lit integer -47 1 0
    lit integer -48 1 0
    lit integer -49 1 0
    lit integer -50 3 255
    lit integer -51 2 30
    lit integer -52 2 60
    lit integer -53 3 255
    lit integer -54 1 0
    lit integer -55 1 0
    lit integer -56 3 255
    gga integer -57 23 10
    bind integer 1 -41
    bind integer 2 -42
    bind integer 3 -43
    bind integer 4 -44
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -45
    bind integer 8 -46
    bind integer 9 -47
    bind integer 10 -48
    bind integer 11 -49
    bind integer 12 -50
    bind integer 13 -51
    bind integer 14 -52
    bind integer 15 -53
    bind integer 16 -54
    bind integer 17 -55
    bind integer 18 -56
    bind integer 19 11
    bind integer 20 -57
    call boolean -40 2265 bdw_slider
    jmpt -40 4
    jmp 5
    label 4
    lit boolean -58 4 True
    set boolean 14 -58
    label 5
    add integer -59 3 7
    set integer 3 -59
    lit string -61 1 G
    sub integer -62 2 6
    lit integer -63 3 255
    lit integer -64 3 255
    lit integer -65 3 255
    lit integer -66 3 255
    bind string 1 -61
    bind integer 2 -62
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -63
    bind integer 6 -64
    bind integer 7 -65
    bind integer 8 -66
    call nothing -60 2242 bd_text
    lit integer -68 1 2
    lit integer -69 1 0
    lit integer -70 3 255
    lit integer -71 1 1
    lit integer -72 3 512
    lit integer -73 2 40
    lit integer -74 1 0
    lit integer -75 1 0
    lit integer -76 1 0
    lit integer -77 3 255
    lit integer -78 2 30
    lit integer -79 2 60
    lit integer -80 1 0
    lit integer -81 3 255
    lit integer -82 1 0
    lit integer -83 3 255
    gga integer -84 23 10
    bind integer 1 -68
    bind integer 2 -69
    bind integer 3 -70
    bind integer 4 -71
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -72
    bind integer 8 -73
    bind integer 9 -74
    bind integer 10 -75
    bind integer 11 -76
    bind integer 12 -77
    bind integer 13 -78
    bind integer 14 -79
    bind integer 15 -80
    bind integer 16 -81
    bind integer 17 -82
    bind integer 18 -83
    bind integer 19 11
    bind integer 20 -84
    call boolean -67 2265 bdw_slider
    jmpt -67 6
    jmp 7
    label 6
    lit boolean -85 4 True
    set boolean 14 -85
    label 7
    add integer -86 3 7
    set integer 3 -86
    lit string -88 1 B
    sub integer -89 2 6
    lit integer -90 3 255
    lit integer -91 3 255
    lit integer -92 3 255
    lit integer -93 3 255
    bind string 1 -88
    bind integer 2 -89
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -90
    bind integer 6 -91
    bind integer 7 -92
    bind integer 8 -93
    call nothing -87 2242 bd_text
    lit integer -95 1 3
    lit integer -96 1 0
    lit integer -97 3 255
    lit integer -98 1 1
    lit integer -99 3 512
    lit integer -100 2 40
    lit integer -101 1 0
    lit integer -102 1 0
    lit integer -103 1 0
    lit integer -104 3 255
    lit integer -105 2 30
    lit integer -106 2 60
    lit integer -107 1 0
    lit integer -108 1 0
    lit integer -109 3 255
    lit integer -110 3 255
    gga integer -111 23 10
    bind integer 1 -95
    bind integer 2 -96
    bind integer 3 -97
    bind integer 4 -98
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -99
    bind integer 8 -100
    bind integer 9 -101
    bind integer 10 -102
    bind integer 11 -103
    bind integer 12 -104
    bind integer 13 -105
    bind integer 14 -106
    bind integer 15 -107
    bind integer 16 -108
    bind integer 17 -109
    bind integer 18 -110
    bind integer 19 11
    bind integer 20 -111
    call boolean -94 2265 bdw_slider
    jmpt -94 8
    jmp 9
    label 8
    lit boolean -112 4 True
    set boolean 14 -112
    label 9
    add integer -113 3 7
    set integer 3 -113
    lit string -115 1 A
    sub integer -116 2 6
    lit integer -117 3 255
    lit integer -118 3 255
    lit integer -119 3 255
    lit integer -120 3 255
    bind string 1 -115
    bind integer 2 -116
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -117
    bind integer 6 -118
    bind integer 7 -119
    bind integer 8 -120
    call nothing -114 2242 bd_text
    lit integer -122 1 4
    lit integer -123 1 0
    lit integer -124 3 255
    lit integer -125 1 1
    lit integer -126 3 512
    lit integer -127 2 40
    lit integer -128 1 0
    lit integer -129 1 0
    lit integer -130 1 0
    lit integer -131 3 255
    lit integer -132 2 30
    lit integer -133 2 60
    lit integer -134 3 255
    lit integer -135 3 255
    lit integer -136 3 255
    lit integer -137 3 255
    gga integer -138 23 10
    bind integer 1 -122
    bind integer 2 -123
    bind integer 3 -124
    bind integer 4 -125
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -126
    bind integer 8 -127
    bind integer 9 -128
    bind integer 10 -129
    bind integer 11 -130
    bind integer 12 -131
    bind integer 13 -132
    bind integer 14 -133
    bind integer 15 -134
    bind integer 16 -135
    bind integer 17 -136
    bind integer 18 -137
    bind integer 19 11
    bind integer 20 -138
    call boolean -121 2265 bdw_slider
    jmpt -121 10
    jmp 11
    label 10
    lit boolean -139 4 True
    set boolean 14 -139
    label 11
    jmpt 14 12
    jmp 13
    label 12
    gg unit -141 8
    gg hashtable -143 5
    gg integer -144 274
    lit integer -145 1 1
    bind hashtable 1 -143
    bind integer 2 -144
    bind integer 3 -145
    call integer -142 772 LoadInteger
    gg hashtable -147 5
    gg integer -148 274
    lit integer -149 1 2
    bind hashtable 1 -147
    bind integer 2 -148
    bind integer 3 -149
    call integer -146 772 LoadInteger
    gg hashtable -151 5
    gg integer -152 274
    lit integer -153 1 3
    bind hashtable 1 -151
    bind integer 2 -152
    bind integer 3 -153
    call integer -150 772 LoadInteger
    gg hashtable -155 5
    gg integer -156 274
    lit integer -157 1 4
    bind hashtable 1 -155
    bind integer 2 -156
    bind integer 3 -157
    call integer -154 772 LoadInteger
    bind unit 1 -141
    bind integer 2 -142
    bind integer 3 -146
    bind integer 4 -150
    bind integer 5 -154
    call nothing -140 441 SetUnitVertexColor
    label 13
    call nothing -158 2246 bd_draw_end
    ret nothing
     
    In-game, I can still only see the button, but not the sliders.


    My guess is that the instructions for the function aren't properly updated by the runtime or something...




    I load the map again right after an init (the draw_loop function starts with "everything" commented out, as before).
    This time I don't trigger an update without changing anything.

    I immediately uncomment the button and trigger an update, I get:
    Code (Text):

    Updating function entrypoint__on_chat_input
    Updating function ascii__chr_init
    Updating function ascii__ord_init
    Updating function baddraw__img_list_clear
    Updating function baddraw__cache_string_bytes
    Updating function bdw_slider
    Updating function bdw_vscrollbar
    Updating function unitsliderstuff__draw_loop
    Updating function unitsliderstuff__delayed_init
    Updating function main
    Writing bytecode
    // many many lines of asm
     
    In-game, I don't see the button.

    I add a dummy writeln after the button and trigger an update:
    Code (vJASS):

        if bdw_text_button("click me", x, y, w, h, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, false, lmb) then
            call writeln("foo")
        endif

        call writeln("ABCD")
     


    I get:
    Code (Text):

    Updating function unitsliderstuff__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2271 unitsliderstuff__draw_loop
    lit integer -1 1 0
    set integer 10 -1
    gga integer -2 20 10
    set integer 11 -2
    gga integer -3 21 10
    set integer 12 -3
    gga integer -4 22 10
    set integer 13 -4
    lit integer -5 2 35
    set integer 8 -5
    lit integer -7 1 0
    bind integer 1 -7
    call nothing -6 2245 bd_draw_begin
    lit integer -9 4 1000
    bind integer 1 -9
    call nothing -8 2256 bdw_auto_wid_base
    lit integer -10 3 256
    set integer 4 -10
    lit integer -11 2 64
    set integer 5 -11
    lit integer -13 4 1024
    neg integer -12 -13
    set integer 2 -12
    lit integer -14 3 768
    set integer 3 -14
    lit integer -15 2 48
    set integer 6 -15
    lit integer -17 3 128
    neg integer -16 -17
    set integer 7 -16
    lit boolean -18 5 False
    set boolean 14 -18
    lit string -20 8 click me
    lit integer -21 1 0
    lit integer -22 1 0
    lit integer -23 1 0
    lit integer -24 3 255
    lit integer -25 3 255
    lit integer -26 3 255
    lit integer -27 3 255
    lit integer -28 3 255
    lit boolean -29 5 False
    bind string 1 -20
    bind integer 2 2
    bind integer 3 3
    bind integer 4 4
    bind integer 5 5
    bind integer 6 -21
    bind integer 7 -22
    bind integer 8 -23
    bind integer 9 -24
    bind integer 10 -25
    bind integer 11 -26
    bind integer 12 -27
    bind integer 13 -28
    bind boolean 14 -29
    bind integer 15 11
    call boolean -19 2258 bdw_text_button
    jmpt -19 2
    jmp 3
    label 2
    lit string -31 3 foo
    bind string 1 -31
    call nothing -30 2269 unitsliderstuff__writeln
    label 3
    lit string -33 4 ABCD
    bind string 1 -33
    call nothing -32 2269 unitsliderstuff__writeln
    call nothing -34 2246 bd_draw_end
    ret nothing
     
    In-game, now I can see the button and ABCD (ABCD is printing repeatedly because we are in a loop).

    I delete the writeln, I comment out the button and uncomment the first 4 sliders:
    Code (vJASS):

        // if bdw_text_button("click me", x, y, w, h, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, false, lmb) then
        //     call writeln("foo")
        // endif

        set y = y + dy
        call bd_text("R", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(1, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0x00, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("G", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(2, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0xFF, 0x00, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("B", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(3, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0x00, 0x00, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        set y = y + dy
        call bd_text("A", x - dx, y, font_size, 0xFF, 0xFF, 0xFF, 0xFF)
        if bdw_slider(4, /*
         */
    0, 255, 1, /*
         */
    x, y, 512, 40, 0x00, 0x00, 0x00, 0xFF, /*
         */
    30, 60, 0xFF, 0xFF, 0xFF, 0xFF, /*
         */
    lmb, m.move_x) then
            set any_changed = true
        endif

        if any_changed then
            call SetUnitVertexColor(g_my_unit, bdw_slider_val(1), bdw_slider_val(2), bdw_slider_val(3), bdw_slider_val(4))
        endif
     


    I get:
    Code (Text):

    Updating function unitsliderstuff__draw_loop
    Writing bytecode
    Writing state file
    Ok.
    fun 2271 unitsliderstuff__draw_loop
    lit integer -1 1 0
    set integer 10 -1
    gga integer -2 20 10
    set integer 11 -2
    gga integer -3 21 10
    set integer 12 -3
    gga integer -4 22 10
    set integer 13 -4
    lit integer -5 2 35
    set integer 8 -5
    lit integer -7 1 0
    bind integer 1 -7
    call nothing -6 2245 bd_draw_begin
    lit integer -9 4 1000
    bind integer 1 -9
    call nothing -8 2256 bdw_auto_wid_base
    lit integer -10 3 256
    set integer 4 -10
    lit integer -11 2 64
    set integer 5 -11
    lit integer -13 4 1024
    neg integer -12 -13
    set integer 2 -12
    lit integer -14 3 768
    set integer 3 -14
    lit integer -15 2 48
    set integer 6 -15
    lit integer -17 3 128
    neg integer -16 -17
    set integer 7 -16
    lit boolean -18 5 False
    set boolean 14 -18
    add integer -19 3 7
    set integer 3 -19
    lit string -21 1 R
    sub integer -22 2 6
    lit integer -23 3 255
    lit integer -24 3 255
    lit integer -25 3 255
    lit integer -26 3 255
    bind string 1 -21
    bind integer 2 -22
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -23
    bind integer 6 -24
    bind integer 7 -25
    bind integer 8 -26
    call nothing -20 2242 bd_text
    lit integer -28 1 1
    lit integer -29 1 0
    lit integer -30 3 255
    lit integer -31 1 1
    lit integer -32 3 512
    lit integer -33 2 40
    lit integer -34 1 0
    lit integer -35 1 0
    lit integer -36 1 0
    lit integer -37 3 255
    lit integer -38 2 30
    lit integer -39 2 60
    lit integer -40 3 255
    lit integer -41 1 0
    lit integer -42 1 0
    lit integer -43 3 255
    gga integer -44 23 10
    bind integer 1 -28
    bind integer 2 -29
    bind integer 3 -30
    bind integer 4 -31
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -32
    bind integer 8 -33
    bind integer 9 -34
    bind integer 10 -35
    bind integer 11 -36
    bind integer 12 -37
    bind integer 13 -38
    bind integer 14 -39
    bind integer 15 -40
    bind integer 16 -41
    bind integer 17 -42
    bind integer 18 -43
    bind integer 19 11
    bind integer 20 -44
    call boolean -27 2265 bdw_slider
    jmpt -27 2
    jmp 3
    label 2
    lit boolean -45 4 True
    set boolean 14 -45
    label 3
    add integer -46 3 7
    set integer 3 -46
    lit string -48 1 G
    sub integer -49 2 6
    lit integer -50 3 255
    lit integer -51 3 255
    lit integer -52 3 255
    lit integer -53 3 255
    bind string 1 -48
    bind integer 2 -49
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -50
    bind integer 6 -51
    bind integer 7 -52
    bind integer 8 -53
    call nothing -47 2242 bd_text
    lit integer -55 1 2
    lit integer -56 1 0
    lit integer -57 3 255
    lit integer -58 1 1
    lit integer -59 3 512
    lit integer -60 2 40
    lit integer -61 1 0
    lit integer -62 1 0
    lit integer -63 1 0
    lit integer -64 3 255
    lit integer -65 2 30
    lit integer -66 2 60
    lit integer -67 1 0
    lit integer -68 3 255
    lit integer -69 1 0
    lit integer -70 3 255
    gga integer -71 23 10
    bind integer 1 -55
    bind integer 2 -56
    bind integer 3 -57
    bind integer 4 -58
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -59
    bind integer 8 -60
    bind integer 9 -61
    bind integer 10 -62
    bind integer 11 -63
    bind integer 12 -64
    bind integer 13 -65
    bind integer 14 -66
    bind integer 15 -67
    bind integer 16 -68
    bind integer 17 -69
    bind integer 18 -70
    bind integer 19 11
    bind integer 20 -71
    call boolean -54 2265 bdw_slider
    jmpt -54 4
    jmp 5
    label 4
    lit boolean -72 4 True
    set boolean 14 -72
    label 5
    add integer -73 3 7
    set integer 3 -73
    lit string -75 1 B
    sub integer -76 2 6
    lit integer -77 3 255
    lit integer -78 3 255
    lit integer -79 3 255
    lit integer -80 3 255
    bind string 1 -75
    bind integer 2 -76
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -77
    bind integer 6 -78
    bind integer 7 -79
    bind integer 8 -80
    call nothing -74 2242 bd_text
    lit integer -82 1 3
    lit integer -83 1 0
    lit integer -84 3 255
    lit integer -85 1 1
    lit integer -86 3 512
    lit integer -87 2 40
    lit integer -88 1 0
    lit integer -89 1 0
    lit integer -90 1 0
    lit integer -91 3 255
    lit integer -92 2 30
    lit integer -93 2 60
    lit integer -94 1 0
    lit integer -95 1 0
    lit integer -96 3 255
    lit integer -97 3 255
    gga integer -98 23 10
    bind integer 1 -82
    bind integer 2 -83
    bind integer 3 -84
    bind integer 4 -85
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -86
    bind integer 8 -87
    bind integer 9 -88
    bind integer 10 -89
    bind integer 11 -90
    bind integer 12 -91
    bind integer 13 -92
    bind integer 14 -93
    bind integer 15 -94
    bind integer 16 -95
    bind integer 17 -96
    bind integer 18 -97
    bind integer 19 11
    bind integer 20 -98
    call boolean -81 2265 bdw_slider
    jmpt -81 6
    jmp 7
    label 6
    lit boolean -99 4 True
    set boolean 14 -99
    label 7
    add integer -100 3 7
    set integer 3 -100
    lit string -102 1 A
    sub integer -103 2 6
    lit integer -104 3 255
    lit integer -105 3 255
    lit integer -106 3 255
    lit integer -107 3 255
    bind string 1 -102
    bind integer 2 -103
    bind integer 3 3
    bind integer 4 8
    bind integer 5 -104
    bind integer 6 -105
    bind integer 7 -106
    bind integer 8 -107
    call nothing -101 2242 bd_text
    lit integer -109 1 4
    lit integer -110 1 0
    lit integer -111 3 255
    lit integer -112 1 1
    lit integer -113 3 512
    lit integer -114 2 40
    lit integer -115 1 0
    lit integer -116 1 0
    lit integer -117 1 0
    lit integer -118 3 255
    lit integer -119 2 30
    lit integer -120 2 60
    lit integer -121 3 255
    lit integer -122 3 255
    lit integer -123 3 255
    lit integer -124 3 255
    gga integer -125 23 10
    bind integer 1 -109
    bind integer 2 -110
    bind integer 3 -111
    bind integer 4 -112
    bind integer 5 2
    bind integer 6 3
    bind integer 7 -113
    bind integer 8 -114
    bind integer 9 -115
    bind integer 10 -116
    bind integer 11 -117
    bind integer 12 -118
    bind integer 13 -119
    bind integer 14 -120
    bind integer 15 -121
    bind integer 16 -122
    bind integer 17 -123
    bind integer 18 -124
    bind integer 19 11
    bind integer 20 -125
    call boolean -108 2265 bdw_slider
    jmpt -108 8
    jmp 9
    label 8
    lit boolean -126 4 True
    set boolean 14 -126
    label 9
    jmpt 14 10
    jmp 11
    label 10
    gg unit -128 8
    gg hashtable -130 5
    gg integer -131 274
    lit integer -132 1 1
    bind hashtable 1 -130
    bind integer 2 -131
    bind integer 3 -132
    call integer -129 772 LoadInteger
    gg hashtable -134 5
    gg integer -135 274
    lit integer -136 1 2
    bind hashtable 1 -134
    bind integer 2 -135
    bind integer 3 -136
    call integer -133 772 LoadInteger
    gg hashtable -138 5
    gg integer -139 274
    lit integer -140 1 3
    bind hashtable 1 -138
    bind integer 2 -139
    bind integer 3 -140
    call integer -137 772 LoadInteger
    gg hashtable -142 5
    gg integer -143 274
    lit integer -144 1 4
    bind hashtable 1 -142
    bind integer 2 -143
    bind integer 3 -144
    call integer -141 772 LoadInteger
    bind unit 1 -128
    bind integer 2 -129
    bind integer 3 -133
    bind integer 4 -137
    bind integer 5 -141
    call nothing -127 441 SetUnitVertexColor
    label 11
    call nothing -145 2246 bd_draw_end
    ret nothing
     
    In-game, I can still see the button and the ABCD is still printing, I can't see the sliders.
     

    Attached Files:

    • main.j
      File size:
      14.5 KB
      Views:
      38
  7. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    @Aniki
    I have updated the first post with a new version.
    I don't know what caused updating all the functions even if nothing had changed but it seems to be fixed now. Also i don't know how you compile your map but atleast with the way i do it your script seems to be working for me; can add/remove sliders and button.
    I think the problem was that you've hit the limits on preload. It was six abilities with 500 bytes per ability. Now i've upped the limits to 24 abilities with 700bytes per ability. Also it should now report an error if you hit the limit.
    Also nice widget library, i like it.

    If you still have errors please give an exact description on how to compile your map.

    Oh yes, don't know how i missed that. My compiler should replace all function literals with integer literals. If pjass doesn't accept the resulting .j-file it's a bug.
     
  8. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    I was 'init'ing using jasshelper's '--debug' flag but 'update'ing without it. In 'non-debug'/'release' mode jasshelper does some inlining which Jhcr picked up as changes... sorry about that. Everything seems to work now. Thanks!

    I think it still not too difficult to reach the reloadable bytecode limit though:
    Can the 'reloadable bytecode limit' be removed?

    The ridiculously long argument lists though... I am going to use structs to pack some of the arguments of some of the functions.

    I can't help but notice (with the in-game command '/fps') the "slight" fps drop when the switch to running bytecode happens (in the 'draw_loop' function with the sliders). My guess is that I won't be able to do many many draw calls at the same time (ignoring the 'reloadable bytecode limit'). Can't really complain though, because it's pretty much impossible to write anything fast in Jass, let alone a VM!

    PS: Main.hs... uh?
     
  9. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    Well at one point we would reach the oplimit again. Also it would be nice to know the exact limit on
    BlzSetAbilityTooltip
    because at one point it simply crashes wc3. I have reduced the encoded bytecode a bit already but nothing huge.

    Also it now displays that error better. I just wanted to release a version for people to test.

    Personally i don't see much fps drops but it's in the nature of this to have a performance hit.
    Also the resulting bytecode is very naively generated. One could def write an optimizer for it. It just isn't a priority right now.

    λ
     
  10. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    As you may or may not have noticed, i have regularly uploaded new versions. Most of them were just bug fixes but two changes are of note:
    1.
    ExecuteFunc
    now works correctly (with old or new functions)
    2. globals are now correctly initialized. Once. That means only the value of the global when it is first loaded into the map is saved. After that the interpreter takes the value saved in the state.


    TriggerRegisterVariableEvent
    doesn't work on newly defined globals yet though.
     
  11. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    vJass' array fields implementation seems to trip jhcr:

    Code (vJASS):

    struct Foo
        string array bar[5]
    endstruct

    // => jasshelper's output:
    //JASSHelper struct globals:
    constant integer si__Foo=1
    integer si__Foo_F=0
    integer si__Foo_I=0
    integer array si__Foo_V
    string array s___Foo_bar // <-- 3 '_' here
    constant integer s___Foo_bar_size=5
    integer array s__Foo_bar

    // => jhcr' output
    constant integer si__Foo = 1
    integer si__Foo_F = 0
    integer si__Foo_I = 0
    integer array si__Foo_V
    string array s__Foo_bar // <-- only 2 '_' here
    constant integer s__Foo_bar_size = 5
    integer array s__Foo_bar
     
     
  12. Aniki

    Aniki

    Joined:
    Nov 7, 2014
    Messages:
    564
    Resources:
    6
    Tools:
    1
    Maps:
    1
    Spells:
    1
    JASS:
    3
    Resources:
    6
    Using GUI triggers with JHCR

    It is possible to use GUI triggers and JHCR because GUI triggers are really just Jass generated by the World Editor. It's not as easy and convenient as using [v]Jass directly, because there's some clicking involved, but it is possible.


    Our setup uses 3 ".bat" (windows cmd.exe/shell) scripts. Also these 3 tools are required/invoked by the ".bat" scripts:
    * JHCR (obviously) by LeP
    * MPQEditor by zezula
    * close-map-handle-war3

    Our setup uses the following directory structure:
    Code (Text):

    path\to\test-map-directory
    |
    |- 1-run-after-save-map-before-game-is-running.bat
    |- 2-run-once-after-map-loads-ingame.bat
    |- 3-run-after-save-map-while-game-is-running.bat
    |- test-map.w3x
    |- map-tools
        |
        |- jhcr.exe
        |- MPQEditor.exe
        |- close-map-handle-war3.exe
        |- files
            |
            |- Blizzard.j
            |- common.j
     
    "path\to\test-map-directory" is an arbitrary directory.
    "1-run-after-save-map-before-game-is-running.bat", "2-run-once-after-map-loads-ingame.bat", "3-run-after-save-map-while-game-is-running.bat" are the 3 ".bat" scripts.
    "test-map.w3x" is the name we use for our test map.


    We need to edit the "1-run-after-save-map-before-game-is-running.bat" file. Specifically we need to edit the path to "Warcraft III.exe" and the path to "test-map.w3x".

    We don't have to edit the "2-run-once-after-map-loads-ingame.bat" file.

    We need to edit the "3-run-after-save-map-while-game-is-running.bat" file. Specifically we need to edit the "--preload-path" (unless your user name is also Aniki).


    We can now start the World Editor and create a new map.

    We need to add the mandatory trigger to initialize JHCR, (by calling ExecuteFunc("JHCR_Init_init")).
    [​IMG]

    We also need a way to tell JHCR that we've made changes to our map, and we would like these changes to take effect. We can do it with a trigger similar to this one:
    [​IMG]

    Now we can save our map as "path\to\test-map-directory\test-map.w3x". Then we run the "1-run-after-save-map-before-game-is-running.bat" script (from the console, or clicking on it). It should start Warcraft III and load our test map.

    Our test map doesn't do anything at the moment, so we need to close the game and make it do something. We could add a hero and a trigger that changes its armor by some amount X when we press the escape key. After we add the "something", we again save the map and run the "1-run-after-save-map-before-game-is-running.bat". After the map loads in-game we also run the "2-run-once-after-map-loads-ingame.bat".

    Now instead of closing the game, changing the triggers and then restarting the game we could instead: make changes to our trigger (say change X to X + 1), save the map, run the "3-run-after-save-map-while-game-is-running.bat", in-game: press the escape key (or however we've decided to call ExecuteFunc("JHCR_Init_parse")), and observe our change.


    The attached zip file has the ".bat" scripts, "map-tools", and the necessary directory structure.
     

    Attached Files:

    Last edited: Apr 11, 2019
  13. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    Unless it breaks something that is essential and what the --jasshelper flag does. Since jasshelper inserts a random number of underscores but we need stable names for jhcr to work correctly.

    Thanks for the guide and batch scripts (also i haven't looked at them yet).
    We also have a guide for Wurst.
    I would really enjoy if more people would be using this.
     
  14. Donach

    Donach

    Joined:
    Jan 12, 2011
    Messages:
    98
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Is there gonna be JHCR for 1.31 PTR anytime soon?
     
  15. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    Oh sure, i didn't know people wanted it.
    Here is jhcr for 1.31 just for you.
    Included in this are also a bunch of optimisations for the generated bytecode, so you're able to load a bit more code into the map.
     
  16. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    I have updated jhcr in the main post for patch 1.31. There was a bug in which reload didnt work. I think it was related to the now changed stuff in the next ptr of zero based indexing in natives as i use
    BlzSetAbilityTooltip
    to get the data into the game. I don't know if i have to revert that change once this ptr becomes the next official patch.
     
    Last edited: Jun 9, 2019
  17. Deadreyo

    Deadreyo

    Joined:
    Sep 3, 2014
    Messages:
    130
    Resources:
    1
    Maps:
    1
    Resources:
    1
    "Requested Attachment could not be found". Can you resend the file?
     
  18. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    Works for me. Maybe try again?
     
  19. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    478
    Resources:
    0
    Resources:
    0
    Just wanted to update the attached exe since i fixed some bugs since last release.
    And you don't have to call
    JHCR_Init_init
    anymore; it's now handled automatically but it also doesn't cause any harm.

    Some bugs that were fixed:
    Code (Text):

          Fixed bug in local array handling
          Correctly shadow globals
     
     
  20. kenkz447

    kenkz447

    Joined:
    Dec 8, 2019
    Messages:
    2
    Resources:
    0
    Resources:
    0
    Thanks for geat tool, but it seem not working on Reforge.