You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
+0x - Plus Symbol Used In Hexadecimal Constant #12
The + is used in documentation to indicate a relative offset.
This format works when used as a constant in SB, but the highlighting is lost for the text of the constant.
The +0x highlighting is working but other issues have popped up.
The text for all constants in the CONST..END construct is not highlighted unless that line is selected. Eventually it all fills in.
When switching between SCR and SAv1 edit modes, the highlighting for text of constants breaks. The highlighting that was enabled by scrolling over the line is removed when that line is selected.
Update: I'm currently using SB v3.8.0. Just used the upgrade tool. Need to retest.
After retesting with a current SB build; the +0x highlighting is working and no new issues are immediately apparent.
I still have problems with larger text scripts. If I edit a line with a constant the highlighting disappears for all constants until I scroll to the const..end construct and edit a line. I suspect this might be resolved by adjusting Sanny's scanning range option but haven't tested the idea. (Never mind, scanning range 1000 fixed this issue.)
For some odd reason, these two constants from ePickupType never highlight.
Curious: In SB v3.8.5, BREAK is highlighting but CONTINUE is not. Nether is defined in keywords.ini since the update. Both are listed under compiler.ini.
Should I keep scan range at 1000 or drop it back to 250?
you should find an optimal value for scanning range that works best for you.
smaller number is faster but does not highlight constants declared outside of the range
larger is slower but has better results
The highlighting seems smoother when loading a large script. It could be that the slower 1000 scan range gives a nice impression when loading. It's difficult to compare the difference though.
Everything seems to be highlighting properly.
Overall, I really like the semantic highlighting. It's an awesome feature.
I've got a couple of scripts that are creeping up on the 1000 line scan limit. When working with the default scan range of 250 I was a bit frustrated with the highlighting disappearing from all constants when I edited any line. I kept jumping to the top of the script to tweak a constant definition to get the highlighting back and then struggling to find my place again without breaking the highlighting. The highlighting serves as an automatic spell check - I miss it when it's not up to date. Have you considered a hotkey to manually refresh the highlighting?
Tested the new core.dll with mockups for... chained constants. String and Variable types are highlighting too. I'm assuming the the chains actually work when compiled - they did before; this was only a issue with highlighting.
An observation that... highlights the advantage of highlighting. When I switched to SCR mode some of the R* constants I pulled out of the Dealer.sc script were highlighted as keywords, suggesting a potential conflict.
I haven't tried using these constants in SCR mode so I'm not sure what will happen. But it will be a little disappointing if I can't use standard R* constants in SCR scripts.
Constants defined in constants.txt are highlighting. I thought I read that this didn't work so I'm glad I ran the test.
Constants defined in $Include files are not highlighted - as expected. Not sure how that would work anyway.
This time around I'm trying to avoid modifying Sanny's default configuration files. The strategy inevitably leads to problem when sharing scripts with other players.
I tend to avoid defining constants in $Include files anyway. Highlighting doesn't work, and there's too much risk of conflicts. Instead. I just copy the constants I intend to use and paste them into the scripts header. I might change this strategy if Sanny included standard sets of definitions.
Previous tests suggest that defining large sets of constants in constants.txt can cause a lot of lag in SB. If used conservatively, there are a lot of standard constants that could be defined here, but if everyone doesn't have the same list I don't want to use them.
they [constants defined in $Include files] should be highlighted
Oh wow! This is so cool. After saving the (Untitled) file Sanny was able to find the path to the $Include file and the highlighting filled in. Now I need to research SB's search path to find the best place to group my enums and constants. Awesome!!!!!
I was going to say that the only thing that didn't quite seem perfect, were the constants highlighted as keywords from SCR mode. The hint text can clearly tell the difference; maybe the scanner could too. But after thinking about it for a while, I made this mockup of a hybrid SA/SCR snippet to see how it looks in practice.
const
this_ped = 0@
iTemp = 13@
FINISHED_TASK = 7
TASK_LOOK_ABOUT = 1481
end
062E: get_script_task_status this_ped TASK_LOOK_ABOUT store_to iTemp // ret FINISHED_TASK if not found
00D6: if
04A4: iTemp == FINISHED_TASK // == constant
004D: goto_if_false @DEALER_1603
05C9: task_look_about this_ped -1 ms
Given an example like this, a coder might correctly assume that the appropriate constant to use for the task parameter of 062E has the same name as the keyword for 05C9.
I am not familiar with task commands; are there other commands and constants that show a similar relationship?
I'm thinking, don't change it and call it a feature - Working as Intended.
looks like any TASK_XXX opcode can be used in 062E?
A bit of a tangent but... I've been searching in vain through the SA source files, looking for enums or constant definitions for the tasks, and finally figured out the easy trick - converting the constants to hex with Ctrl-H.
Activity
x87 commentedon May 9, 2023
core/src/language_service/scanner.rs
Line 250 in 10101e9
x87 commentedon May 12, 2023
@OrionSR test with this version
core.zip
OrionSR commentedon May 13, 2023
The +0x highlighting is working but other issues have popped up.
The text for all constants in the CONST..END construct is not highlighted unless that line is selected. Eventually it all fills in.
When switching between SCR and SAv1 edit modes, the highlighting for text of constants breaks. The highlighting that was enabled by scrolling over the line is removed when that line is selected.
Update: I'm currently using SB v3.8.0. Just used the upgrade tool. Need to retest.
OrionSR commentedon May 13, 2023
After retesting with a current SB build; the +0x highlighting is working and no new issues are immediately apparent.
I still have problems with larger text scripts. If I edit a line with a constant the highlighting disappears for all constants until I scroll to the const..end construct and edit a line. I suspect this might be resolved by adjusting Sanny's scanning range option but haven't tested the idea. (Never mind, scanning range 1000 fixed this issue.)
For some odd reason, these two constants from ePickupType never highlight.
IIRC, this is expected behavior.
text_font is not highlighted.
x87 commentedon May 13, 2023
Thank you for testing!
can you show how you define and use them ?
Yes sannybuilder/dev#134
OrionSR commentedon May 13, 2023
Um... Well? I defined them shortly before:
Defining the constant twice should break the highlighting. So everything seems to be working properly.
OrionSR commentedon May 13, 2023
Curious: In SB v3.8.5, BREAK is highlighting but CONTINUE is not. Nether is defined in keywords.ini since the update. Both are listed under compiler.ini.
x87 commentedon May 13, 2023
add Break & Continue to keywords.ini
x87 commentedon May 13, 2023
break is highlighting in SA SCR because of 084C=BREAK
x87 commentedon May 13, 2023
@OrionSR could you please test the recursive highlighting with this version?
core.zip
OrionSR commentedon May 13, 2023
Is there anything in particular I should be looking for?
Should I keep scan range at 1000 or drop it back to 250?
x87 commentedon May 13, 2023
check your example with
text_font = Font_Aharoni.text_font should now be getting the same coloring as Font_Aharoni. try different types
here is a updated version
core.zip
x87 commentedon May 13, 2023
you should find an optimal value for scanning range that works best for you.
smaller number is faster but does not highlight constants declared outside of the range
larger is slower but has better results
OrionSR commentedon May 13, 2023
The highlighting seems smoother when loading a large script. It could be that the slower 1000 scan range gives a nice impression when loading. It's difficult to compare the difference though.
Everything seems to be highlighting properly.
Overall, I really like the semantic highlighting. It's an awesome feature.
I've got a couple of scripts that are creeping up on the 1000 line scan limit. When working with the default scan range of 250 I was a bit frustrated with the highlighting disappearing from all constants when I edited any line. I kept jumping to the top of the script to tweak a constant definition to get the highlighting back and then struggling to find my place again without breaking the highlighting. The highlighting serves as an automatic spell check - I miss it when it's not up to date. Have you considered a hotkey to manually refresh the highlighting?
OrionSR commentedon May 13, 2023
I missed this note before - but it wasn't working until the latest core was installed.
Looks good now.
OrionSR commentedon May 13, 2023
Tested the new core.dll with mockups for... chained constants. String and Variable types are highlighting too. I'm assuming the the chains actually work when compiled - they did before; this was only a issue with highlighting.
An observation that... highlights the advantage of highlighting. When I switched to SCR mode some of the R* constants I pulled out of the Dealer.sc script were highlighted as keywords, suggesting a potential conflict.
sa_scr\keywords.txt
I haven't tried using these constants in SCR mode so I'm not sure what will happen. But it will be a little disappointing if I can't use standard R* constants in SCR scripts.
x87 commentedon May 13, 2023
TASK_LOOK_ABOUT TASK_LOOK_ABOUTis perfectly fine. First word is the opcode 05C9, the second is the constant 1481OrionSR commentedon May 13, 2023
Rounding out the easy tests:
Constants defined in constants.txt are highlighting. I thought I read that this didn't work so I'm glad I ran the test.
Constants defined in $Include files are not highlighted - as expected. Not sure how that would work anyway.
This time around I'm trying to avoid modifying Sanny's default configuration files. The strategy inevitably leads to problem when sharing scripts with other players.
I tend to avoid defining constants in $Include files anyway. Highlighting doesn't work, and there's too much risk of conflicts. Instead. I just copy the constants I intend to use and paste them into the scripts header. I might change this strategy if Sanny included standard sets of definitions.
Previous tests suggest that defining large sets of constants in constants.txt can cause a lot of lag in SB. If used conservatively, there are a lot of standard constants that could be defined here, but if everyone doesn't have the same list I don't want to use them.
x87 commentedon May 13, 2023
they should be highlighted. I just checked and it worked for me. Are you sure they are in the scanning range?
Simple test:
c.txt
script.txt
OrionSR commentedon May 13, 2023
Oh wow! This is so cool. After saving the (Untitled) file Sanny was able to find the path to the $Include file and the highlighting filled in. Now I need to research SB's search path to find the best place to group my enums and constants. Awesome!!!!!
OrionSR commentedon May 13, 2023
Everything is highlighting except for "alloc" in
alloc ($Extended_Var, 14999).OrionSR commentedon May 13, 2023
I was going to say that the only thing that didn't quite seem perfect, were the constants highlighted as keywords from SCR mode. The hint text can clearly tell the difference; maybe the scanner could too. But after thinking about it for a while, I made this mockup of a hybrid SA/SCR snippet to see how it looks in practice.
Given an example like this, a coder might correctly assume that the appropriate constant to use for the task parameter of 062E has the same name as the keyword for 05C9.
I am not familiar with task commands; are there other commands and constants that show a similar relationship?
I'm thinking, don't change it and call it a feature - Working as Intended.
x87 commentedon May 13, 2023
it really depends on Coloring Theme. Try other themes, they could highlight them using different colors
https://github.com/sannybuilder/themes#gallery
https://docs.sannybuilder.com/editor/options/editor#color-theme
https://docs.sannybuilder.com/editor/options/theme-editor
x87 commentedon May 13, 2023
looks like any
TASK_XXXopcode can be used in 062E?OrionSR commentedon May 14, 2023
A bit of a tangent but... I've been searching in vain through the SA source files, looking for enums or constant definitions for the tasks, and finally figured out the easy trick - converting the constants to hex with Ctrl-H.
sa_scr\keywords.txt
The task ID is the same as the associated opcode number.