You must be logged in to post messages.
Please login or register

AI & RM Scripting
Moderated by Leif Ericson

Hop to:    
Welcome! You are not logged in. Please Login or Register.3 replies
Age of Kings Heaven » Forums » AI & RM Scripting » 'if' inside rms comments
Bottom
Topic Subject:'if' inside rms comments
Zetnus
Squire
posted 10-08-18 01:45 PM CT (US)         
I have heard that supposedly there is an issue in all versions of the game (other than the newest userpatch), where if inside /* comments */ gets parsed by the map generator when it shouldn't be.
I was wondering if anyone (Scripter64?) could shed light on the specifics of this?

........//\
......./ / / \ Check out my Blacksmith submissions as well as my stuff in the Steam Workshop.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Updated New RMS Guide <<<version 3 is out<<<
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.
AuthorReplies:
scripter64
Wolved
posted 10-08-18 11:07 PM CT (US)     1 / 3       
Hi! Yes, Henk and TWest reported an issue where if the word "if" is present within an rms comment, the branch system might enter an unreliable state from that point forward. It was fixed a few months ago in UP v1.5 build 6168. This change may "break" a map if it contains severe syntax errors (unended comments, missing or misplaced endif lines, etc.) by parsing the script "as written" without having the bugged state randomly cause it to "work". Henk or TWest may be able to provide some examples of the issue.

[This message has been edited by scripter64 (edited 10-08-2018 @ 11:09 PM).]

Zetnus
Squire
posted 10-09-18 05:59 AM CT (US)     2 / 3       
Alright, thanks for the explanation.
If I understand correctly, the word if should not be used anywhere in comments to be safe and to make sure a script will work in all versions of the game.
This works well, because the notepad++ syntax I use, also breaks the collapsing if if is in comments. I noticed that while trying to make a map pack, so I replaced all if in comments with *if instead.

Are any other other things affected, like else or anything else (lol)?

........//\
......./ / / \ Check out my Blacksmith submissions as well as my stuff in the Steam Workshop.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Updated New RMS Guide <<<version 3 is out<<<
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.
scripter64
Wolved
posted 10-09-18 09:00 AM CT (US)     3 / 3       
The rms parser is case-sensitive, so "If" and "IF" are fine, but "if" can cause issues without the recent fixes. To be safe on all versions, it would probably be best to avoid any rms branch commands inside comments, including "else", "elseif" and "endif". Changing these to "ELSE", "ELSEIF", and "ENDIF" inside comments should be fine.

On an unrelated note about map pack rms scripts, if you have any general purpose #const values that are used by more than 1 script inside the file (like the ones used for effect_amount, etc.), it's best to copy those #consts out of the individual map if/elseif blocks to the top of the script. This can avoid some unexpected issues with 2+ parameter rms commands, where #consts within an unused block remain undefined as the parser works its way through the unused block's commands to find the next elseif/endif branch command. yES lol

[This message has been edited by scripter64 (edited 10-09-2018 @ 09:12 AM).]

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames