Jump to content

NumbNutsJunior

Member
  • Content Count

    60
  • Joined

  • Last visited

  • Medals

Everything posted by NumbNutsJunior

  1. Any Ideas on how to make the use of key down fire only once. I am trying to get a DrawIcon3D to run only when tilt key is being held down. So that you can quickly toggle it off and on by holding and releasing a key. The problem with KeyDown is that it will run DrawIcon3D over and over until you let go of the key and clearly that is not ideal cause fps goes to shit and i cant close it. The code below is just the basic framework of any display event handler: waitUntil {!(isNull (findDisplay 46))}; (findDisplay 46) displayAddEventHandler ["KeyDown", { switch (_this select 1) do { case 41: {hintSilent "Key Down"}; // Tilt Key }; false }]; waitUntil {!(isNull (findDisplay 46))}; (findDisplay 46) displayAddEventHandler ["KeyUp", { switch (_this select 1) do { case 41: {hintSilent "Key Up"}; // Tilt Key }; false }];
  2. NumbNutsJunior

    KOTH profile

    That is a private server that you need to go through their KOTH website, teamspeak, or discord. I know that Hostile Takeover does a profile restore session like once a week but I don't think anyone on here can help you with that.
  3. I was using the command countSide which does not seem to work correctly as once it reaches 2 it just jumped to 0: same applies to playableUnits _playersWest = west countSide allUnits; hint str(_playersWest); Am I missing something, if there is a way to count all living units on a specific team returning a number please let me know
  4. I am trying to return 'true' to the function if the "Attacking Button" is pressed and 'false' if the "Defending Button" is pressed. if (dialog) then {closeDialog 0}; _attackOrDefend = createDialog "AttackOrDefend"; // (findDisplay 997) displayAddEventHandler ["KeyDown", {if ((_this select 1) isEqualTo 1) then { true }}]; // Disable ESC Key _attackingButton = ((findDisplay 997) displayCtrl 1600); // Attacking Button _defendingButton = ((findDisplay 997) displayCtrl 1601); // Defending Button _return = nil; /* Find return code ... */ waitUntil {!(isNil "_return")}; _return; Using functions such as ButtonSetAction do not allow me return true or false as they are not in the scope of the function: _attackingButton buttonSetAction "_return = true"; _defendingButton buttonSetAction "_return = false"; Using the work around that Kronzky provides only allows you to use variables already defined in the script to the action but not from the action to the script: _foo = "foo"; buttonSetAction [100, format["hint '%1 bar'", _foo]]; Please Help! I have destroyed the wiki looking for ways.
  5. That is a good idea, ill give it a test @HazJ
  6. _attackingButton = ((findDisplay 997) displayCtrl 1600); // Attacking Button _defendingButton = ((findDisplay 997) displayCtrl 1601); // Defending Button @HazJ
  7. @HazJ I am trying to get a return value of whether the player decided to attack or defend so a dialog is called from the initPlayerLocal ... It is suppose to return a Boolean so that i can decide where to send the player whether he is defending or attacking a location: I am no an expert on scripting so clearly my ways of trying to solve the problem could be bad, but I am trying to not use globals or trashy ways of scripting like calling publicVariables over and over // initPlayerLocal.sqf [_player] spawn Onx_fnc_waitingScreen; waitUntil {dialog}; // Puts all players on waiting screen _coinFlip = call Onx_fnc_coinFlip; // Returns True or False to decide which team gets choice _coinFlip = true; // Testing only, delete after _isWestLeader = player isEqualTo westLeader; _isEastLeader = player isEqualTo eastLeader; if ((_coinFlip) and (_isWestLeader)) then { isAttacking = [_coinFlip] call Onx_fnc_isAttacking; waitUntil {!(isNil "isAttacking")}; ... I currently have solved the issue by using in the action: player setVariable ["isAttacking", true]; Like i said i don't like assigning globals so any other way would be much more clean
  8. I have tried working with the ButtonClick event handler but the event handlers run in their own scope, how am I suppose to get the result of ButtonClick to the function so I can store it in a variable such as _return?
  9. I have modified a previously made script to be called run a progress bar across the screen and as long as the script was not aborted before "time" reached the "total time" then the script would return true and otherwise return false. My problem comes when someone wants to exit the script, they cant and are forced to sit through the entire progress bar. I am trying to fail the script by pressing the ESC Key. I have simply made "hint 'ESC Key'" for debugging. /* Author: HallyG Edited by: Acoward Edited by: NumbNutsJunior Description: Draws a progress bar to visualise an action taking place. Parameter(s): 0: [STRING] - Text to display 1: [SCALAR] - Total Time 2: [STRING] - Animation name - (Default: "AinvPknlMstpSnonWnonDnon_medic_1") Returns: [BOOLEAN] Example: _a = ["Eating...", 10, "Animation ..."] call HGF_fnc_progressBar; if (_a) then { ... result ... }; */ params [["_text","Test",[""]],["_actionTime",10,[0]],["_animation","AinvPknlMstpSnonWnonDnon_medic_1",[""]]]; private ["_startTime","_totalTime","_progressBar","_progressText","_return"]; if (player getVariable ["isBusy",false]) exitWith {}; // IF PLAYER IS BUSY ALREADY, EXIT player setVariable ["isBusy",true,true]; // SETS THE PLAYER'S STATUS TO BUSY disableSerialization; ("HGF_progressBar" call BIS_fnc_rscLayer) cutRsc ["HGF_ProgressBar", "PLAIN", 0.001, false]; // display PROGRESS BAR _progressBar = ((uiNamespace getVariable "HGF_ProgressBar") displayCtrl 22202); _progressBar progressSetPosition 0; _progressText = ((uiNamespace getVariable "HGF_ProgressBar") displayCtrl 22201); _progressText ctrlSetText _text; _startTime = time; // Start Time _totalTime = time + _actionTime; // Expected finish time _return = true; _eventHandler = (findDisplay 46) displayAddEventHandler ["KeyDown", { if ((_this select 1) isEqualTo 1) then {hint "ESC Pressed"}; true }]; waitUntil { _progressBar = ((uiNamespace getVariable "HGF_ProgressBar") displayCtrl 22202); _progressBar progressSetPosition ((time - _startTime)/_actionTime); // Sets the progress position of the progress bar. if (animationState player != _animation) then { player switchMove _animation; // PLAYS ANIMATION IF PLAYER IS NOT PLAYING THE ANIMATION player playMoveNow _animation; }; (!alive player) || (time >= _totalTime) || ((vehicle player) != player)// if player is dead or passed end time, exit }; player setVariable ["isBusy",false,true]; // SETS THE PLAYER'S STATUS TO NOT BUSY if ((!alive player) || (time <= _totalTime) || ((vehicle player) != player)) then { _return = false; _progressText ctrlSetText ""; // ACTION NOT COMPLETED _progressBar progressSetPosition 0; }; (findDisplay 46) displayRemoveEventHandler ["KeyDown", _eventHandler]; player switchMove ""; // Resets to default animation ("HGF_progressBar" call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; // HIDES PROGRESS BAR _return;
×