• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[vJASS] problem with HCL

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
Hi
i need HCL for the bot hosting a map.

i put the library trigger.
but then i need to detect if HCL was used or not...

so i need something like "call HCL_GetCommand()" but how does it work?

[Jass=]function Trig_HCL_detect takes nothing returns nothing
call HCL_GetCommandString()
endfunction

//===========================================================================
function InitTrig_HCL_detect takes nothing returns nothing
set gg_trg_HCL_detect = CreateTrigger( )
call TriggerAddAction( gg_trg_HCL_detect, function Trig_HCL_detect )
endfunction[/code]

how do i call the function? (the command is white, not green, does it mean it doesn't work?)
how do i store it? ( how to transfert the data into a variable?)
then i only need to compare it null or not null //
and then read the data and launch the HCL game mode, or go to player choose mode.

need help please (do i need the "implement library" ?)
 
To read the mode entered by the bot, just call HCL_GetCommandString(). If it returns the empty string, there was no mode entered.

So you would just do:
JASS:
if HCL_GetCommandString() == "" then
 // actions
endif
That checks if the string is empty (meaning no mode was entered, the handicaps weren't altered).

As for your questions:
(1) You can use it like I did above. It will show up as white because it is from a custom library, not from the common.j/blizzard.j
(2) Like so:
JASS:
globals
    string myString = ""
endglobals

function Example takes nothing returns nothing
    set myString = HCL_GetCommandString()
endfunction

If you want to set it to a GUI variable, then remove the globals block and just put udg_ as a prefix. But make sure that the function Example is called at some point. (you should do it on map start, probably after 0 elapsed seconds or something)

You can also just do this in GUI:
  • HCL
    • Events
      • Time - Time elapsed equal to 0.00 seconds
    • Conditions
    • Actions
      • Custom script: set udg_myStringVariable = HCL_GetCommandString()
 
Status
Not open for further replies.
Top