Skip to content

Fix loop variable inconsistency in scr_dialogue.gml #727

@coderabbitai

Description

@coderabbitai

Description

In scripts/scr_dialogue/scr_dialogue.gml, there's a loop with inconsistent loop variables that needs to be fixed:

-for(var ii=1; i<=200; i++){if (obj_ini.role[0,ii]==obj_ini.role[100][eROLE.ChapterMaster]) and (string_count("$",obj_ini.spe[0,ii])>0) then born=true;}
+for(var ii=1; ii<=200; ii++){if (obj_ini.role[0,ii]==obj_ini.role[100][eROLE.ChapterMaster]) and (string_count("$",obj_ini.spe[0,ii])>0) then born=true;}

The loop is initializing variable ii but using i in the condition and increment parts. This will cause the loop to behave unpredictably as it's incrementing the wrong variable.

Context

This issue was identified in PR review #725: #725

Specific comment thread: #725 (comment)

Reproduction

The issue occurs in the function that checks if the Chapter Master has a special marker in their specialization.

Fix

Update the loop to consistently use the same variable (ii) for initialization, condition, and increment.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions