Jump to content

Coding scripts in SSL: some lessons


Recommended Posts

19 hours ago, DavidW said:

Upthread: "Precious little" is an expression, roughly synonymous with "almost nothing". Action(Literal) is just a hardcoded action with no trigger conditions and no actions. Mostly it's syntactic sugar (i.e., language that makes code easier for humans to read but doesn't matter to the compiler); there are one or two use cases (if you want to use probabilities in a literal action, notably).

OK, it should be clear now, thanks.

To tell the truth, I think it may be useful for what I need to do (in conjunction with DELETE_SCRIPT_BLOCK 🙂.....)

Link to comment

That's actually handled by the ssl_to_bcs function in SFO (in stratagems/sfo/general/general.tpa), not by the SSL perl script. If the second angle bracket evaluates to 1, the contents of the first angle bracket are inserted; if not, nothing is inserted.

Link to comment

So, I have a question about setting variables from outside the SSL script itself, in the command line. If I write

Spoiler

AT_NOW ~/usr/bin/perl	%MOD_FOLDER%/ssl/ssl.pl	%MOD_FOLDER%/components/component_1/TEST.ssl	-l %MOD_FOLDER%/ssl/library.slb	mod_folder=%MOD_FOLDER%&Test=True~	EXACT

 

the variable "Test" doesn't get set. As a matter of fact, if TEST.ssl contains something like

Spoiler

IF TRIGGER
	IgnoreBlock(Test)
	Detect(NearestEnemyOf(Myself))
THEN DO
	Action(Attack)
END

 

that block does get compiled (the SSL compiler should ignore it since "Test" is supposed to be set to True....)

What am I missing?

Edited by Luke
Link to comment

Next: as you know, you can put multiple triggers when using 'ConditionalTargetBlock()'. My question is: can you OR() two or more triggers? I mean, you can currently write 'A AND B' via "&". Is there an equivalent symbol for 'A OR B'?

Related: I noticed that you cannot write

Spoiler

ConditionalTargetBlock(PCsInOrderShort;TriggerBlock(Test))

 

That'd be handy.......

Edited by Luke
Link to comment
On 7/28/2019 at 4:10 PM, DavidW said:

LOOP - basically does multiple copies of a chunk of SSL code, with a different value of a variable each time. Look at SCS, there are quite a few examples.

Is it possible to write the following in a compact way?

BEGIN LOOP(scsloopvar||NearestEnemyOf(Myself);SecondNearestEnemyOf(Myself);ThirdNearestEnemyOf(Myself);FourthNearestEnemyOf(Myself);FifthNearestEnemyOf(Myself);SixthNearestEnemyOf(Myself))

I tried with 

BEGIN LOOP(scsloopvar||EnemiesInOrder)

but it's not working......

Thanks in advance

Link to comment
On 9/22/2019 at 7:47 PM, DavidW said:

No. There's no variable substitution into loops (basically because loops themselves are executed right at the start).

Well, fortunately there's a workaround 🙂

Spoiler

BEGIN LOOP(scsloopvar||;Second;Third;Fourth;Fifth;Sixth)
	IF TRIGGER
		!StateCheck(scsloopvarNearestEnemyOf(Myself),STATE_REALLY_DEAD)
	THEN DO
		Action(Test)
	END
END LOOP

 

 

Edited by Luke
Link to comment
On 9/1/2019 at 3:38 PM, DavidW said:

No. (Basically because the underlying bcs language doesn’t allow higher-level OR(), so it would have required a tedious amount of propositional logic.)

Actually, it does seem to be possible, see below.

ConditionalTargetBlock(EnemiesInOrderShort;OR(2)&Kit(scstarget,BLACKGUARD)&Class(scstarget,BARD))

Separately: I noticed there are some 'ActionCondition()'s in SCS, but are they functional? I'm asking because I keep getting an error when using them... Moreover, according to the underlying perl code, they seem to be functionally identical to standard 'Action()'s...

if ($scsline=~m/ActionCondition\(/ eq "1") {
	extract_from_brackets();
	push @action, $scsline;

 

Link to comment

A quick note for the 2-3 people who use SSL: unlike TRIGGERs, you cannot combine multiple TARGETs inside a single "TargetBlock()" using the character "|".

You need to use either "*" (only the first argument in "TargetBlock()" will be considered) or "&" (all the arguments in "TargetBlock()" will be considered).

For instance:

TargetBlock(PCMages*PCsInOrderShort)	// "PCsInOrderShort" will be discarded

TargetBlock(PCMages&PCsInOrderShort)	// First "PCMages", then "PCsInOrderShort"

 

Edited by Luke
Link to comment
On 3/17/2020 at 11:14 AM, Luke said:

A quick note for the 2-3 people who use SSL: unlike TRIGGERs, you cannot combine multiple TARGETs inside a single "TargetBlock()" using the character "|".

You need to use either "*" (only the first argument in "TargetBlock()" will be considered) or "&" (all the arguments in "TargetBlock()" will be considered).

For instance:


TargetBlock(PCMages*PCsInOrderShort)	// "PCsInOrderShort" will be discarded

TargetBlock(PCMages&PCsInOrderShort)	// First "PCMages", then "PCsInOrderShort"

 

@DavidW

Could you please state if the above info is correct? If so, what's the purpose of *?

Link to comment

'&' is intended notation, and works as you suggest. '*' I don't know about. That character doesn't appear in BAF scripts, normally - it may be that SSL's parser is just ending its script read at it. Or it may be some subtler bit of functionality I've forgotten about.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...