Staredit Network > Forums > SC1 Mapping Tools > Topic: LIT - Lua Interpreted Triggers
LIT - Lua Interpreted Triggers
May 21 2014, 7:14 am
By: CecilSunkure  

Oct 31 2015, 3:07 am CecilSunkure Post #21



To add onto my previous post:

Lets say next we want to add a greet message whenever we go in the direction of location A to location B that looks like this:





To do so we can add a parameter to the ConnectRooms function. It's a good time to make use of a trick in Lua for optional parameters, this lets us add in a greet message from A to B, from B to A, or neither. Here's an example:

Code
ConnectRooms( "link's house a", "link's house b", "<13><1C>:: <4>Link's House <1C>::" )


The above line will generate triggers that displays a greet only going from A to B. We can add in another parameter for a message going from B to A (maybe saying that we are back in Hyrule):


Code
ConnectRooms( "link's house a", "link's house b", "<13><1C>:: <4>Link's House <1C>::", "<13><1C>:: <4>Hyrule <1C>::" )


It is easy to see the greet messages that I am using have some redundant text formatting. I can hide the text formatting inside of the ConnectRooms function, so long as I want the formatting to be the same for all greets (which I do):

Code
ConnectRooms( "link's house a", "link's house b", "Link's House", "Hyrule" )


The finished ConnectRooms function looks like:

Code
-- create the deathcounter variable with LIT
local roomDC = Deaths( )
roomDC:SetUnit( "Terran Physics Lab" )
roomDC:SetPlayer( 8 )

-- function that generates triggers to connect two locations
-- together to act as a doorway for a "hero unit" called LINK
function ConnectRooms( a, b, greetA, greetB )
   -- move from a to b
   p8:Conditions( )
   roomDC:SetCount( 0 )
   roomDC:Exactly( )
   BringExactly( 1, LINK, a, 1 )
   p8:Actions( )
   roomDC:SetCount( 1 )
   roomDC:SetTo( )
   MoveUnit( 1, LINK, 1, a, b )
   if greetA then Text( "<13><1C>:: <4>" .. greetA .. " <1C>::" ) end
   Preserve( )
   
   -- move from b to a
   p8:Conditions( )
   roomDC:SetCount( 0 )
   roomDC:Exactly( )
   BringExactly( 1, LINK, b, 1 )
   p8:Actions( )
   roomDC:SetCount( 1 )
   roomDC:SetTo( )
   MoveUnit( 1, LINK, 1, b, a )
   if greetB then Text( "<13><1C>:: <4>" .. greetB .. " <1C>::" ) end
   Preserve( )
   
   -- turn off the DC when not present at a or b
   p8:Conditions( )
   BringExactly( 1, LINK, a, 0 )
   BringExactly( 1, LINK, b, 0 )
   roomDC:SetCount( 1 )
   roomDC:Exactly( )
   p8:Actions( )
   roomDC:SetCount( 1 )
   roomDC:SetTo( )
   Preserve( )
end




None.

Nov 9 2015, 9:53 am CecilSunkure Post #22



v1.10 released (link in OP)

Features:
-Automated allocation of death counters/switches
-More fully featured "shorthand notation" functions
-Made a docs pdf (in OP)
-Updated command line slightly to let users place their source wherever they like
-#if #then #end for nesting triggers together in arbitrary #if control structures
-better error reporting (stack trace)
-WINDOWS ONLY: triggers copied to clipboard upon completion
-Integrated to chkdraft (still need to send jj this latest version)



None.

Jan 9 2018, 3:30 am jjf28 Post #23

Cartography Artisan

Converting the memory condition to use memory addresses as the first parameter by default, Chkdraft users will have the option to change a setting to use playerId in the memory condition/actions, let me know if LIT should have it set to use playerId by default or if you want to update LIT or what not.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Sep 8 2018, 7:31 pm goobie Post #24



First off, this is fantastic!

I would request that death counters are allocated for units that cannot be killed first, such as "Goliath Turret" or "Nuclear Missile". After the list of unkillable units is exhausted, then LIT could generate a warning when it's finished compiling.

As it stands the first death counter allocated is "Protoss Gateway", and the first several at least are units that can be killed during play, depending on the map. I'll probably implement this change to a local copy of LIT for a map I'm working on, if you want the changes.

Thanks!

P.S. Also, allowing allocation of death counters by playergroup! So each player in the playergroup gets a dc, and when a playergroup dc is used in a trigger, it generates triggers for players using their specific death counter. Kind of like "Current Player" behaves.

Post has been edited 1 time(s), last time on Sep 8 2018, 7:36 pm by goobie.



There's got to be something more to life than being really, really, ridiculously good looking...

Sep 9 2018, 4:53 am goobie Post #25



Ok, I've looked at Lock.lua pretty closely. I did find a couple issues. First, it seems that some unit names available for death counters include several spaces in a row, such as "Duke Turret type 1". It seems whatever you used to pull the strings killed the extra spaces, so Lock.lua has "Duke Turret type 1", which won't compile in trigedit.

The good news is, this always happens after the string "type", so a find-replace should fix all instances. The bad news is, some valid units with this space typo look like they've been removed to make the triggers compile. I have a modified Lock.lua with the complete unit list, with both problems fixed if you'd like it.

Finally, I don't believe we want to allocate death counters for "Any unit", "Buildings", "Factories", or "Men", which appear at the end of the list in Lock.lua

Cheers!

Edit: I made the changes to Lock.lua, let me know if you'd like the file!

Post has been edited 4 time(s), last time on Sep 23 2018, 7:38 pm by goobie.



There's got to be something more to life than being really, really, ridiculously good looking...

Jul 17 2019, 12:58 am CecilSunkure Post #26



Hey there goobie, sure! Post up your file and we can probably incorporate it into LIT. At some point I will revisit this thread and revive LIT and put it on github properly. This way we can easily report issues or make pull requests. For now though I am not actively using LIT. However, if anyone wanted to use LIT and wants my help I'm available for help nearly every day. It's easiest to contact me on twitter @randypgaul.



None.

Jul 17 2019, 8:53 am Blackbirdx661 Post #27



Just saying thanks. Was looking at your LIT project a couple days ago. Looks very interesting and I appreciate the work that went into it; have been mentally blocking out some scenario's where accessing triggers via the AI would be very handy. I'm sure it's going to become an important part of the tool box.



It is better to live one day as a Lion,
than 100 Years as a Lamb.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Sie_Sayoka