Jump to content

DavidW

Gibberlings
  • Posts

    6,173
  • Joined

  • Last visited

Everything posted by DavidW

  1. Lesson three: Defining ACTIONs Now we start getting into how SSL scripts actually work. A lot of BG2 scripting consists of repeating very similar blocks again and again. Spellcasting, for instance, requires you to check for whether the caster actually has the spell; in tactical scripting it usually also requires you to check whether a timer has expired (so that you don't try to cast until you're able to) and then to reset that timer again. So even a rather simple-minded mage script might look like IF !GlobalTimerNotExpired("cast","LOCALS") HaveSpell(WIZARD_FLAME_ARROW) See(NearestEnemyOf(Myself)) THEN RESPONSE #100 SetGlobalTimer("cast","LOCALS",6) Spell(NearestEnemyOf(Myself),WIZARD_FLAME_ARROW) END IF !GlobalTimerNotExpired("cast","LOCALS") HaveSpell(WIZARD_MELF_ACID_ARROW) See([PC.0.0.MAGE]) THEN RESPONSE #100 SetGlobalTimer("cast","LOCALS",6) Spell([PC.0.0.MAGE],WIZARD_MELF_ACID_ARROW) END IF !GlobalTimerNotExpired("cast","LOCALS") HaveSpell(WIZARD_MAGIC_MISSILE) See(NearestEnemyOf(Myself)) THEN RESPONSE #100 SetGlobalTimer("cast","LOCALS",6) Spell(NearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE) END The core of SSL is the ability to automate production of repetitive blocks like this. This action, which we might call Spell, would be coded in SSL as follows: BEGIN ACTION DEFINITION Name(Spell) TRIGGER !GlobalTimerNotExpired("cast","LOCALS") HaveSpell(scsargument1) ACTION RESPONSE #scsprob SetGlobalTimer("cast","LOCALS",6) Spell(scstarget,WIZARD_MAGIC_MISSILE) END This looks a bit like a standard BCS block, but it has some things missing and some odd features - notably the expressions "scstarget","scsargument1" and "scsprob1". These are all choosable when the block is called. "scstarget" and "scsprob1" are common to all ACTION blocks: the first is the actual target of the action (such as NearestEnemyOf(Myself)) and the second is the probability of the action being carried out (which by default is set to 100). "scsargment1" is specific to a particular action: different actions require different arguments. The "Spell" action, for instance, requires only one argument (other than a target): the name of the spell to be cast. More complex actions require more arguments. For instance, illithids in SCS2 use their powers on a timer, so that they can case (e.g.) Maze every three rounds. A typical BCS block for an illithid would be IF !GlobalTimerNotExpired("cast","LOCALS") !GlobalTimerNotExpired("maze","LOCALS") See(NearestEnemyOf(Myself)) THEN RESPONSE #100 SetGlobalTimer("cast","LOCALS",6) SetGlobalTimer("maze","LOCALS",18) ForceSpell(NearestEnemyOf(Myself),PSIONIC_MAZE) END and the corresponding ACTION would look like BEGIN ACTION DEFINITION Name(Psionic) TRIGGER !GlobalTimerNotExpired("cast","LOCALS") !GlobalTimerNotExpired(scsargument2,"LOCALS") ACTION RESPONSE #scsprob SetGlobalTimer("cast","LOCALS",6) SetGlobalTimer(scsargument2,"LOCALS",scsargument3) ForceSpell(scstarget,scsargument1) END The "Psionic" action has three arguments: scsargument1 is the name of the power to use, scsargument2 is the name of the timer to be set, and scsargument3 is the length of time the timer is to be set for.
  2. Lesson two: running SSL SSL itself is a perl script (ssl.pl) which has been compiled into a Windows executable (ssl.exe). Its formal syntax is ssl.exe "<list of ssl files> -l <list of slb files> <variable string> The ssl files are the actual code; they conventionally have the suffix .ssl and this will be added if un-suffixed files are called. The slb files are "library files" containing common data (this will all be explained later); they conventionally have the suffix ".slb" and again this will be added to unsuffixed files. The variable string will be explained much later; it's basically a way of modifying at the command line exactly what's done with a string. An (imaginary) example might be scsii/ssl/ssl.exe "scsii/mage/mage_definitions scsii/mage/dw#mage -l scsii/ssl/library scsii/ssl/autolib IsLich=True&CreType=Undead" Here the ssl program itself, and the library files library.slb and autolib.slb are located in the directory scsii/ssl, and the ssl files mage_definitions.ssl and dw#mage are located in scsii/mage. There are two variables: IsLich is set to True and CreType is set to Undead. The result of this process is to generate a number of .baf files: usually one per ssl file called, though some ssl files are just used to define things and don't generate output. Any file that does generate output is dumped in the directory ssl_out relative to its current location - in this case, for instance, dw#mage.ssl would generate the output file scsii/mage/ssl_out/dw#mage.baf. This file would then have to be compiled normally from WEIDU. If the directory ssl_out doesn't exist, SSL will complain: you need to create it in advance. You can use SSL in your mods in two ways. The simplest is to write your scripts in SSL, compile them locally, and distribute the resultant BAF. For more complex mods you probably want to do the compilation inside the TP2 file, using AT_NOW. This is easiest if you just define a macro to do it for you: there's an example in SCSII.
  3. Lesson one: what is SSL? SSL is the "Stratagems scripting language". Formally speaking, it's what you might call a "metascripting language": just as a BAF script, written in a text editor, is compiled into a BCS file, so an SSL file is compiled (by a rather messy bit of Perl scripting) into a BAF file. In practice, though, SSL is an alternative (or perhaps a supplement) to BAF as a way of writing scripts for IE games. It can't ultimately do anything that BAF can't do (ultimately, an SSL file is just another way of producing a BCS file) but it is much more compact and easy to do powerful programming in... well, once you get the hang of it. Partly this shows itself in up-front writing costs: a 5,000 line BAF file might only be a couple of hundred lines of SSL. At least as important, though, SSL makes the logical structure of the script much clearer and easier to understand, debug, and modify. If you want to (say) make a mild change in how all wizards use their spells in a tactical mod, SSL allows you to do it by changing just one line; the BAF method might require thousands of lines to be changed. (In a sense, SSL aims to do for scripting something like (but more modestly than) what the WEIDU .d file format did for dialog writing. Under the hood, functions like CHAIN and INTERJECT_COPY_TRANS generate hideous spaghettified code, but it doesn't matter because the user only sees the clean logical structure.)
  4. The BCS scripts in Sword Coast Stratagems II are largely written in an automated scripting language called "ssl" (Stratagems Scripting Language). (SSL is emphatically not a rival to WEIDU: it's a program - a Perl script, in fact - callable from inside WEIDU). I've been promising, and putting off, releasing that language for ages - not because it's buggy (I think it's pretty stable) but because I can't really work out how to document it. So here's a partial attempt: not a formal rigorous documentation, but an unfinished set of lessons. I've done the first six lessons so far, and they cover enough to make SSL usable, but there's quite a lot more to say and I'll add other bits if there's demand. SSL isn't downloadable on its own at the moment: it's contained in the "ssl" subdirectory of SCSII. At some point I might make a freestanding version available; at the moment, though, I think there's something to be said for looking at how it works in the only mod that currently uses SSL. I don't actually know if SSL will be useful to anyone or not. It's certainly not a beginner's tool: these lessons assume the reader is fluent in IE scripting. Its main use is for long complex scripts and for situations where you want to use lots of closely-related but non-identical scripts. Comments avidly sought. (Also, someone move this if it's in the wrong place...)
  5. Sounds like an SCSII issue, yes - one of the outstanding problems with the current version is the occasional shout problem like this one.
  6. Now that SCS II is in open beta testing, I don't think there's much point having a separate closed discussion forum. So I've moved the two vaguely-live threads in this forum into the main SCS II forum. If no-one who posted here objects, I'll ask Cam to lock it and then make it globally visible after that.
  7. So it does, and unnecessarily so. Fixed locally.
  8. http://users.ox.ac.uk/~mert0130/scs/scsII.zip Sorry!
  9. The latest beta is now out, at the usual download address. A few bugfixes, and a couple of new components (improved shade lord; nerfed inquisitor dispel). I'm planning to move to open beta release within a few days if possible, so I'd very much appreciate knowing if it installs on someone's system.
  10. FIX to this version: as Kimmel caught, there's a fatal error in its code (which, irritatingly, doesn't show up on my computer). If you've already installed, the easiest fix is to go to the file "scsII\ssl\ssl.tph", open it in Notepad, and change "scsII\ssl\ssl.pl" to "scsII\ssl\ssl.exe". Otherwise, download again, I'll fix it in the next two minutes. (And if you have perl installed on your machine and linked to the .pl extension, you don't need to do anything.)
  11. Sorry, beta version 5 didn't last long, did it? Version 6 only fixes two bugs, but one of them is impossible to fix by hotfix. If you're using Cloudkill much, definitely upgrade straight away; if not, do it at your convenience. [edit: this is the fixed version 6] setup_scsII.zip
  12. Beta 5 is out - all bugs so far found are fixed (I hope...) Install at your convenience. Change of procedure, btw - this time I've just attached the file direct to this post. setup_scsII.zip
  13. Hello, I'm back. As I predicted, the first critical bug turned up seconds after I left! Dump the attached into scsII/ascension and the Ascension component should (I hope!) install correctly. I don't think there's anything else critical that's come up; I've fixed locally most of the things people listed on the threads. scsII_hotfix.zip
  14. A critical bug with liches has been found by Coaster. If you've already downloaded and installed beta 4, download the attached file, unzip, and dump into your override. If you haven't yet downloaded, don't worry about this - it's fixed now. scsII_hotfix.zip
  15. The 4th beta version of SCSII is now out. I've just posted it to the usual address, http://users.ox.ac.uk/~mert0130/scs/scsII.zip There aren't (as I recall) any critical bugfixes in v4, so there's no urgency to upgrade. But it does incorporate all the bugfixes so far, and also some AI streamlining. Notably, it's now much more efficient at handling spells like cloudkill: monsters will move to the edge of the effect, try to find their way around it (imperfectly), and priests will use Zone of Sweet Air where appropriate. Also (harded than it sounds, actually) dragons now detect when traps are being set and react accordingly.
  16. No current bugfixes, since beta 3 just came out.
  17. Coaster has found a serious hidden error which I can't easily correct by a hotfix, so I've uploaded a beta version 3. This version fixes Coaster's bug, and all the other bugs so far identified; it also streamlines wizard and demon strategies for dealing with hit-and-run PCs a bit. If beta testers could update when they have a chance, that'd be great; it's at the usual address, users.ox.ac.uk/~mert0130/scs/scsII.zip
  18. New (very minor) bugfix, courtesy Salk: - on certain component choices, the drow in Sendai's enclave weren't spellcasting properly - djinn weren't getting their improved AI - Minute Meteors cast by enemies still count as +6, not +2 As a temporary fix, just unzip the attached and drop the (5) files into the override directory. Edit: now also contains fix for homicidal Alibakkar guards. Edit: now also reverts civilians to the old Shout scripts (this sorts out Coaster's Belmin issue) Edit: fixes CTD with Cacofiend spell.
  19. Duh. I forgot to actually copy over the icons for the fine weapons. (Thanks, coaster). To save you rolling back and reinstalling everything, just unzip the attached and drop them into your override (they're all files with names like dw#abc.bam, in case you want to remove them later for some reason.) icon.zip
  20. No apology needed - it's not as if I'm paying you for this
  21. No current bugfix, because I've just released a new beta version.
  22. Sorry for the delay - version 2 of the beta is now posted at http://users.ox.ac.uk/~mert0130/scs/scsII.zip If beta testers could (when it's convenient) upgrade, that would be great. Obviously there's no need to start a new game! It's probably best if you uninstall version 1, delete it, unzip version 2 and then install again, though probably nothing disastrous will happen if you don't. There are a couple of components in beta 2 that weren't quite ready for beta 1. One of them makes your party immune to permanent death (that only works if you start a new game, though, and anyway I've tested it fairly thoroughly). The other component modifies the AI of the Ascension enemies to be SCS II style. I'd very much appreciate someone testing that (when you get to ToB) but only test it if you've already completed the "original" Ascension and know what it's like. The Readme of the new version is still not quite complete but it's a lot more detailed than the old one.
  23. Sorry if there's a cleverer place to report this, but there's a typo in the "cross-platform variables" list on the wiki, I think. OUTER_SPRINT "NashkelMines_MulaheysCave" "FW5404" should read OUTER_SPRINT "NashkelMines_MulaheysCave" "FW5405"
  24. F***, that's what I get for doing a bugfix in a hurry. The typo that prevented Lemernis's reinstall of the Mages component is now fixed.
×
×
  • Create New...