Page MenuHomeFeedback Tracker

"_thisScript" variable not available in Waypoint scripts
Feedback, NormalPublic

Description

  1. Place unit in editor
  2. Add scripted waypoint with a path to a script with content:

systemChat str [_thisScript];

  1. Notice undefined variable error

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General

Event Timeline

veteran29 created this task.Aug 9 2024, 8:13 PM

Why do you need the _thisscript in here?

BIS_fnc_KK changed the task status from New to Need More Info.Aug 12 2024, 2:24 AM
veteran29 added a comment.EditedAug 12 2024, 11:40 AM

To be able to detect when a current waypoint is changed or deleted when using Per frame handler / unscheduled for waypoint logic (in most performant way, could probably be done by checking currentWaypoint).

params ["_group"];

[{
    params ["_thisScript"];
    if (scriptDone _thisScript) exitWith {true};
    // blah blah some logic
    // eg. setVelocityTransformation
    _someLogicCondition
}, {
    params ["", "_group"];
    _group setVariable ["my_wpDone", true];
}, [_thisScript, _group]] call CBA_fnc_waitUntilAndExecute;

waitUntil {_group getVariable ["my_wpDone", false]};
dedmen added a subscriber: dedmen.Aug 12 2024, 11:43 AM

Also inconsistent, as scheduled scripts in general should have _thisScript. So you'd assume that if canSuspend, that you can access _thisScript too.
remoteExec and particle scripts and init.sqf and action scripts were also missing it.

dedmen changed the task status from Need More Info to Feedback.Aug 12 2024, 11:47 AM
BIS_fnc_KK reassigned this task from BIS_fnc_KK to dedmen.Fri, Aug 16, 12:50 PM
BIS_fnc_KK added a subscriber: BIS_fnc_KK.