How to include a header in file of sub-folder in SQF? - sqf

I have a mission with the following structure
init.sqf
radio/script1.sqf
radio/script2.sqf
script3.sqf
macros.hpp
in script3.sqf, I can use #include "macros.hpp". However, I am not being able to do the same in script1.sqf, as it causes the game to crash. Any ideas?

In radio/script1.sqf, you can include "macros.hpp" using
#include "../macros.hpp"
This is reported in this PDF, in section 4, "#include".
They use the other slash \, but I tested in arma 3 that / works.
Notice that if you add
#include "../macros.hpp"
to script3.sqf, the game will crash, and the error message is what you would expect. Specifically, it can be radio/macros.hpp not found.

Related

VS code parse error ignored in some components

Currently working on an html template using angular, and I have this code:
<a mat-list-item class="side-link" [routerLinkActive]="['is-active']" [routerLink]="[{outlets: { agent-sidebar: ['agent-manage-clients'] } }]"><i class="fas fa-user mr-3"></i>Clients</a>
As you can see, there's nothing wrong with the code. However, doing an ng build produces an error whereas the compiler is looking for a missing : token where I think is unnecessary.
Why does my compiler keep looking for a 'missing' token even though I have closed the braces correctly?
This is funny to me because this is a copy pasted working code in a different component and only produced an error when I pasted it in this new component. So why isn't it producing the same error in the other component?
So apparently, I've fixed this bug of mine by changing the name of my router-outlet. It turns out that naming my outlet agent-sidebar with the token - messes up the compiler somehow. So after almost half a day of work, I've changed this:
[routerLink]="[{outlets: { agent-sidebar: ['agent-manage-clients'] } }]"
to this:
[routerLink]="[{outlets: { agentSidebar: ['agent-manage-clients'] } }]"
and compiler is now working properly.

VS code Error : settings.json property expected (bug)

enter image description here
When I use VS Code, a problem notice likes that(in the above image) is printed.
Although I want to fix it and really don't want to see it, I can't find any way to fix.
I am very painful about just seeing that error message all the time.
Please give me some helps.
You opened a { parenthesis at line 2784 and didn't close it. You should close it. --> }
Also, you have an extra comma , at 2793 that you have to remove.
Not use {}, because you may already mess your settings.json before.
so my suggestion as follows:
// in/your/settings.json/file
...
setting0_name:[setting0.0, setting0.1],
seting1_name : settings,
...

MediaWiki: how to prevent template from inserting white space?

Today, I tried to create a template on Portuguese Wikipedia inside one of my subpages. It works fine with this code:
<includeonly>'''{{{num}}}''': <span style="font-family:monospace;">{{{date}}}</span> — [[{{{title}}}]]<!--
--> {{#if:{{{faults|}}}<!--
-->|({{{faults}}})<!--
--->|}}<br /></includeonly>
This code creates items like this:
81: 28/feb — Der heimliche Aufmarsch gegen die Sowjetunion (one source)
But, I want to do more! The purpose of creating this template isn't just to set the date to monospace fonts... I want to add support for information about translations, and about deletions. Every time I tried to add text about deletions (you can check in the page history), the space between the lines got enormous, making the "lists" very, very ugly...
For example, this is one of the solutions I tried to add deletion information:
<includeonly>'''{{{num}}}''': <span style="font-family:monospace;">{{{date}}}</span> — [[{{{title}}}]]<!--
--> {{#if:{{{faults|}}}<!--
-->|({{{faults}}})<!--
-->|}}<!--
-->{{#if:{{{Speedy-del|{{{Semi-speedy-del|{{{Consensus-del|}}}}}}}}}|
{{#if:{{{Speedy-del|}}}<!--
-->|<div style="margin-left:2em">✘ <small>Speedy deletion denied by {{{Speedy denier}}} on {{{Speedy date}}}</small></div><!--
-->|}}
{{#if:{{{Semi-speed-del|}}}<!--
-->|<div style="margin-left:2em">✘ <small>Semi-speedy deletion denied by {{{Semi-speedy denier}}} on {{{Semi-speedy date|}}}</small></div><!--
-->|}}
{{#if:{{{Consensus-del|}}}|<!--
--><div style="margin-left:2em">✘ <small>Consensus deletion denied on {{{Consensus date|}}}</small></div><!--
-->|}}
|<br />}}</includeonly>
Why is this happening to me? I could not find any typo. So the problem must be logical, and I gave up trying to find a solution alone. My logic must be broken.
You can use HTML comments if you want to make sure there is no extra output from your template, but still need linebreaks etc for readability:
<includeonly><!--
-->'''{{{num}}}''': {{{date}}}<!--
-->[[{{{title}}}]]<!--
-->{{#if:{{{faults|}}}| ({{{faults}}})|}}<br><!--
--></includeonly>

Mediawiki: Same section with multiple names (section aliases/synonyms)

Is it possible to give the same section multiple names in mediawiki out-of-the-box (vastly preferred), or do I need to write my own hook/extension/plugin (and if so, tips on how to do so much appreciated)?
In my case, I have example code on single compilation page that I want to link to for multiple individual articles by the name of each article. For instance, I would like something like the following the work.
Page: Interrupts Code Examples
===(EIMSK|EICRA)===
void interrupt01_init(void)
{
EICRA = 0X0F; // in binary, 1111. That is, the rising edge of INT1 and INT0 generate an interrupt request.
EIMSK = 0X03; // in binary, 0011. Enables INT0 and INT1 interrupts.
}
and both of the following would link to the same section, but with the appropriate name for each page:
Page: EICRA:
[[Interrupts Code Examples#{{PAGENAME}}]]
Page: EIMSK:
[[Interrupts Code Examples#{{PAGENAME}}]]
For full context, see example page http://narwhaledu.com/AVRwiki/index.php?title=PCMSK0.
It's possible I could use something like mediawiki: is there a way to automatically create redirect pages that redirect to the current page?, but is it possible to write it for sections instead of pages? Also, although acceptable, I would prefer not to have the allowed aliases be ALL the sections on a page; for instance, on http://narwhaledu.com/AVRwiki/index.php?title=Interrupts_Code_Examples, I have an "about" section.
Edit:
If it wasn't clear, ideally the when the user visits
Page: Interrupts Code Examples#PAGENAME
they see a properly populated section title, instead of "EIMSK or EICRA Example Code" (since there can be a LOT of aliases to a code example)
==={{{PAGENAME}}}===
void interrupt01_init(void)
{
EICRA = 0X0F; // in binary, 1111. That is, the rising edge of INT1 and INT0 generate an interrupt request.
EIMSK = 0X03; // in binary, 0011. Enables INT0 and INT1 interrupts.
}
I can get transclusion to work but not links.
Page: Template:Interrupts Code Examples
=={{#ifexist: {{{pagename}}} | [[{{{pagename}}}]] | External Interrupts Example Code One}}==
{{Template:ExampleCode~PCMSK0, PCMSK1, PCMSK2, PCICR, PCINT0_vect, PCINT1_vect}}
My ideal syntax would be
[[ Template:Interrupts Code Examples|pagename={{PAGENAME}} ]]
but obviously this produces instead a link to the nonexistant page pagename=Name_of_Register instead of linking to Interrupts Code Examples and passing the parameter {{PAGENAME}} such that I can reference it in Interrupts Code Examples with {{{pagename}}} and thereby generate my section header..
This would keep the compilation page clean (only have two code examples instead of copying each one 5x for each alias, my current solution), but I can only pass parameters to the template if I transclude, not if I link to the template, I believe. Is this true?
I may just use the "Example Code One" catchall for wiki markup readability in the end since this is starting to break my brain...
Any HTML anchor will work as a section link. So, if you have <span id="foo">, you can use [[Bla#foo]] to jump to the span. You'll need one HTML element per ID, but that's still workable I think.

Emacs Actionscript 3 indentation for functions defined inline in an arglist

I'm using the actionscript-mode-connors.el for indenting Actionscript 3 code in emacs.
I have most things figured out, but one thing bothering me is when I use an inline closure as a function argument, the indentation of the interior of the function is screwed up.
For example:
var foo:int = some_function(
bar,
baz,
function():void {
return qux();
},
zap);
I want return qux() to be a single indent from the function declaration on the previous line, not a single indent from the open paren. The indentation of 'bar' used to be screwed up too but I fixed that with
(add-hook 'actionscript-mode-hook
(lambda ()
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close 0)))
Typically here I would use C-c C-s to figure out what syntactic symbols I need to change, but the problem on the 'return qux()' line is that the syntax context is
((arglist-cont-nonempty 731 758) (brace-list-intro 731))
where those numbers refer to the 'some_function' line. 'arglist-cont-nonempty' seems like a mistake, and it seems like it should be 'arglist-cont', since there's nothing after the open paren on that line. I can't change the indentation for 'arglist-cont-nonempty' since that would affect the case where the open paren does not end the 'some_function' line as well.
How can I fix this?
I would use espresso-mode for ActionScript. It indents your example correctly.
How about an indirect answer? It seems as though you're relatively comfortable with the C indentation machine. You might want to use advice around 'c-guess-basic-syntax to recognize the particular configuration and modify it to be what you think would make the most sense for that situation.
If you take a look at this answer for an indentation customization for comments, I essentially did the same thing, only at the point of indentation.
Regarding your specifics, I cannot reproduce the same failure you have, my indentation for that chunk of code (in 'actionscript-mode with your two changes) looks like:
var foo:int = some_function(
bar,
baz,
function():void {
return qux();
},
zap);
Also, the syntax for the return qux(); line is: ((brace-list-intro 319)).
It seems that your hunch is correct (that the arglist-cont-nonempty list is the problem), and changing the output of 'c-guess-basic-syntax seems like it would be a viable solution.
Can I also point out the obvious test? Have you started without any customizations and loading just action-script? I did so with the latest action-script and Emacs 23.1 and got the results you see above. Tested with M-x c-version showing both 5.31.3 and 5.31.7 (the later is distributed with Emacs 32.1).