Skip to content

Value of private variable '<variablename>' is never used in loops #65

@Hamster2k

Description

@Hamster2k

In my while loop, a variable shows up as never used, even though the value is used in the next iteration of the loop.

My code:

`waitUntil {
!isNil {
_this getVariable "bloodLevel"
}
};

_previousBloodLevel = _this getVariable "bloodLevel";

while { true } do {
if (_this getVariable "isVampire") exitWith {};

_currentBloodLevel = _this getVariable "bloodLevel";

if (_previousBloodLevel > 30 and _currentBloodLevel <= 30) then {
	"You feel weak." remoteExec ["hint", _this];
};

if (_previousBloodLevel <= 30 and _currentBloodLevel > 30) then {
	"You feel somewhat stronger." remoteExec ["hint", _this];
};

_previousBloodLevel = _currentBloodLevel;
_currentBloodLevel = _currentBloodLevel + 3;

if (_currentBloodLevel > 100) then {
	_currentBloodLevel = 100;
};

_this setVariable ["bloodLevel", _currentBloodLevel];

sleep 15;

}`

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions