• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] question about library

Status
Not open for further replies.
Level 2
Joined
Nov 25, 2013
Messages
11
Hello, every people. Sorry for my english.
I have a question about library.
There is a library which adds functions. It is initialized by using the hash table . In the map all works normally . When used in the campaign is not working. When you start a black screen. The file itself must be kept in a folder with the game. All of the code is as follows. Question: Is it possible to use the library in the campaign ? If so, how?
Library:
http://xgm.guru/files/100/160205/KeyV2.mix
Library in Jass
http://xgm.guru/files/100/160205/comments/301517/CJass.rar
Kode:
JASS:
globals
    hashtable HT = InitHashtable() 
endglobals

function InitSys takes nothing returns nothing
    call SetPlayerTechMaxAllowed(Player(15),900125,GetHandleId(HT))
endfunction

function CursorMove takes integer mouseX, integer mouseY returns nothing
    call SaveInteger(HT,0,0,1)
    call SaveInteger(HT,-3,1,1)
    call SaveInteger(HT,-3,2,mouseX)
    call SaveInteger(HT,-3,3,mouseY)
endfunction

function SetBorderMouse takes integer minX, integer minY, integer maxX,integer maxY returns nothing

call SaveInteger(HT,0,0,1)
call SaveInteger(HT,-6,1,1)
call SaveInteger(HT,-6,2,minX )
call SaveInteger(HT,-6,3,minY )
call SaveInteger(HT,-6,4,maxX )
call SaveInteger(HT,-6,5,maxY )

endfunction

function ClearBorderMouse takes nothing returns nothing
call SaveInteger(HT,0,0,1)
call SaveInteger(HT,-6,1,1)
call SaveInteger(HT,-6,2,-127 )
call SaveInteger(HT,-6,3,-127 )
call SaveInteger(HT,-6,4,-127 )
call SaveInteger(HT,-6,5,-127 )
endfunction

function PlayerText takes string text, real duration returns nothing
    local integer CurrentQueue = LoadInteger(HT,-4,1)
    call SaveInteger(HT,0,0,1)
    
    call SaveInteger(HT,-4,1,CurrentQueue+1)
    call SaveStr(HT,-4,2+CurrentQueue*2,text)
    call SaveReal(HT,-4,3+CurrentQueue*2,duration)
endfunction

function GetMouseX takes nothing returns integer
    return LoadInteger(HT,-1,1)
endfunction
function GetMouseY takes nothing returns integer
    return LoadInteger(HT,-1,2)
endfunction

function GetTriggerKey takes nothing returns integer 
    return LoadInteger(HT,-5,1)
endfunction

function GetScreenWidth takes nothing returns integer
    return LoadInteger(HT,-2,1)
endfunction
function GetScreenHeidht takes nothing returns integer
    return LoadInteger(HT,-2,2)
endfunction

function fun_pressed_Key takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,I2S(GetTriggerKey()))
    call SetBorderMouse(25,25,400,400)
endfunction

function fun_release_Key takes nothing returns nothing
    call ClearBorderMouse()
endfunction

function fun_pressed_LMB takes nothing returns nothing
call DisplayTextToPlayer(Player(0),0,0,"fun_pressed_LMB")
endfunction

function fun_release_LMB takes nothing returns nothing
call DisplayTextToPlayer(Player(0),0,0,"fun_release_LMB")
endfunction


function fun_pressed_RMB takes nothing returns nothing
call DisplayTextToPlayer(Player(0),0,0,"fun_pressed_RMB")
endfunction

function fun_release_RMB takes nothing returns nothing
call DisplayTextToPlayer(Player(0),0,0,"fun_release_RMB")
endfunction

This code catches the keyboard buttons and mouse clicks.


Thank you in advance.
 
Last edited by a moderator:
Level 2
Joined
Nov 25, 2013
Messages
11
as this will help ? The program optimizes the map . I do not see that it is connected vjass
 
as this will help ? The program optimizes the map . I do not see that it is connected vjass

The code you posted requires vJASS/cJASS because of the globals block.

You can make it so that it doesn't require vJASS/cJASS by making a hashtable variable in the variable editor named "HT" and renaming all usage of it to udg_HT (make sure you initialize the hashtable in an initialization trigger), and then remove the globals block portion of the code.

Alternatively, you can use the campaign compiler on xgm.ru (or in JNGP 2.0.7, although it is currently not working)--or you can just save the map separately and import it into your campaign.

JassHelper doesn't play nicely with vJASS and campaigns due to the campaign compilation being a completely separate process entirely (I assume it is the same with AdicHelper.. in fact it is probably related to Grimoire more than anything else).
 
Status
Not open for further replies.
Top