Alright, I am back!
Quote from name:Tuxedo-Templar
Is there a way to add in conditions or actions inside in an existing trigger via a loop or MACRODEF or something equivalent?
Like the "PLACEHOLDEROMG"? No way to define your own conditions, and macroses are only for triggers. But could you tell me what are you going to achieve?
Some.
Edit: Actually never mind.
See my email about the compile fail, though. I can't figure out what's wrong.
None.
Uh... Can't see the email yet!..
Oh lol, found 3 emails!
EDIT: oh, well for record-sake
[06:49 pm] Tuxedo-Templar -- Ugh shoutbox butchers replies you should use the thread instead.
[06:49 pm] [DeVouReR]:] -- hi tux oO
[06:49 pm] Wormer -- And yes, the best way to achieve the effect of the "PLACEHOLDEROMG" is defining
macroses I guess...
[06:48 pm] Tuxedo-Templar -- I'm aware of that.
[06:48 pm] Tuxedo-Templar -- No you're right apparently you can't. I'm just used to that from these dumb
scripting languages I work with.
[06:47 pm] Wormer -- Just to make it clear
[06:46 pm] Wormer -- And macro definitions as you understand does not result in any triggers in output
[06:45 pm] Tuxedo-Templar -- Noted. Thanks for the tip.
[06:45 pm] Wormer -- Also, I'm not sure if you can use macroses before they are defined
[06:44 pm] Tuxedo-Templar -- Oh ok. Shoulda guessed it would be something stupid after all.
[06:41 pm] Wormer -- And if you don't need the loop variable in the loop body you can use
REPEAT n <body> ENDL
[06:40 pm] Wormer -- Also, as a hint, the BY thing in loops is optional, default value is 1
[06:39 pm] Wormer -- And you can't have any macro definitions inside loops, that's why it waits for 'ENDL'
[06:38 pm] Wormer -- Nope, just line 542 for-loop is not closed!
[06:35 pm] Wormer -- lol =) I'm looking into it now
[06:29 pm] Tuxedo-Templar -- sup. I broke MT I think.
Post has been edited 2 time(s), last time on Aug 10 2009, 2:53 pm by Wormer.
Some.
Heh. It was a stupid mistake of mine after all.
Given my frequent habit of trigger refactoring and cut and paste, I'm going to amend my conventions to wrap each looped trigger individually within separate declarations of its loop rather than putting multiple triggers inside the same loop block. I think that just makes more sense, and should prevent more dumb mistakes like that.
For that particular case, I declared the macro ahead of its use for organizational purposes. Not strictly necessary, but during AG I always hated shoving a few oddball triggers into the middle of an otherwise-neat and uniform group of existing triggers to work around yet another Starcrap design idiosyncrasy. I didn't get to find out if macros didn't work before their declaration on account of that non-terminated loop, though.
None.
Quote from name:Tuxedo-Templar
Given my frequent habit of trigger refactoring and cut and paste, I'm going to amend my conventions to wrap each looped trigger individually within separate declarations of its loop rather than putting multiple triggers inside the same loop block. I think that just makes more sense, and should prevent more dumb mistakes like that.
This made me think of a probably useful language construct added as an optional suffix to a trigger and specifying to copy it required number of times like...
TRIGGER(int i=0; i<21; i++)
OWNERS:
CONDITIONS:
ACTIONS:
ENDT
LOL it's like C-style, brrr...
TRIGGER MULTIPLY n=0 TO 21 BY 2
OWNERS:
CONDITIONS:
ACTIONS:
ENDT
brrrr, don't know, but might be not a bad idea...
Some.
Actually it wouldn't be bad, but it isn't necessary. FOR or REPEAT really isn't that bad to use.
None.
I have recently completed a concept map using Macro Triggers and will release it soon.
Edit:
My maps Macro Triggers
// "a" is the input X and Y coordinate
// "b" is the output X coordinate
// "c" is the output Y coordinate
// "d" loops the trigger until all possible combinations are met
// "e" is a counter to tell me the input Y coordinate. "e" is multiplied by 65536 and added with "a" to get input X and Y coordinate
// "f" a counter to tell me when to add "c"
// The formula is 65536(y) + 1(x)
INTEGER a = 0
INTEGER b = 1
INTEGER c = 1
INTEGER d = 0
INTEGER e = 0
INTEGER f = 0
TRIGGER
OWNERS: @P(2)
CONDITIONS:
Memory(161763, @AtLeast, 1)
Memory(161763, @AtMost, 31)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cantina"))
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cave"))
PreserveTrigger()
Comment("")
ENDT
FOR d = 0 TO 24574 BY 1 DO
IF a <= e * 65536 + 2016 THEN a = a + 32 b = b + 1 ENDIF
IF f >= 32 THEN f = 0 c = c + 1 ENDIF
IF a >= e * 65536 + 2047 THEN e = e + 1 a = 65536 * e b = 1 f = f + 1 ENDIF
TRIGGER
OWNERS: @P(2)
CONDITIONS:
Memory(161763, @AtLeast, a)
Memory(161763, @AtMost, a + 31)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, b, @U("Cantina"))
SetDeaths(@CurrentPlayer, @Set, c, @U("Cave"))
PreserveTrigger()
Comment("")
ENDT
ENDL
Post has been edited 1 time(s), last time on Aug 11 2009, 8:34 pm by Morphling.
None.
I'm genuinely curious to see how well a 24575 trigger map works out.
None.
I doubled the trigger count for two people. It doesn't lag one bit, but it takes a little to load and there is a noticable delay when you quit.
None.
I'm bored and decided to post my map.
You must be one of the two players in the top force to see the concept. Just order the scourge and an explosion will appear where you clicked. There are 49,240 triggers in this map, but it doesn't lag. However, there will be a noticable delay when you start and quit the map due to the massive amount of triggers.
This map has a lot of potential, but it's limits may be lag and the large file size.
This would not be possible without Macro Triggers. Thank you Wormer!
Edit: Sorry about the double post. I forgot I posted last.
Attachments:
None.
Your map completely crashed my sc, haha.
It's probably my very old CPU that exploded xD
EDIT: It was because of odd dimensions. Though it took my computer over 3 minutes to open the map once loaded xD And SC did crash when I exited... rofl!
Post has been edited 1 time(s), last time on Aug 12 2009, 3:32 am by payne.
None.
It never crashed any of my testers. The dimensions are fine. You do not need to play a normal sized before playing this.
None.
60x12 isn't fine without playing a normal sized map before
And it did crash me, but it's probably because my computer sucks balls
And I'll surely take a look at this when I'll start triggering my RPG
None.
The map is 64x12.... If one dimension is normal then you don't need to play a normal sized map before playing this.
Edit: There was a small problem in the code.
Correct Code
// "a" is the input X and Y coordinate
// "b" is the output X coordinate
// "c" is the output Y coordinate
// "d" loops the trigger until all possible combinations are met
// "e" is a counter to tell me the input Y coordinate. "e" is multiplied by 65536 and added with "a" to get input X and Y coordinate
// "f" a counter to tell me when to add "c"
// The formula is 65536(y) + 1(x)
INTEGER a = 0
INTEGER b = 1
INTEGER c = 1
INTEGER d = 0
INTEGER e = 0
INTEGER f = 0
TRIGGER
OWNERS: @P(1)
CONDITIONS:
Memory(19047, @AtLeast, 1)
Memory(19047, @AtMost, 31)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cantina"))
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cave"))
PreserveTrigger()
Comment("")
ENDT
FOR d = 0 TO 24574 BY 1 DO
IF a <= e * 65536 + 2016 THEN a = a + 32 b = b + 1 ENDIF
IF a >= e * 65536 + 2047 THEN e = e + 1 a = 65536 * e b = 1 f = f + 1 ENDIF
IF f >= 32 THEN f = 0 c = c + 1 ENDIF
TRIGGER
OWNERS: @P(1)
CONDITIONS:
Memory(19047, @AtLeast, a)
Memory(19047, @AtMost, a + 31)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, b, @U("Cantina"))
SetDeaths(@CurrentPlayer, @Set, c, @U("Cave"))
PreserveTrigger()
Comment("")
ENDT
ENDL
Post has been edited 1 time(s), last time on Aug 12 2009, 3:37 pm by Morphling.
None.
Ugrh, MorphLing... could you explain it better please? Can't get it xD
This made me think of a probably useful language construct added as an optional suffix to a trigger and specifying to copy it required number of times
Quote from name:Tuxedo-Templar
Actually it wouldn't be bad, but it isn't necessary. FOR or REPEAT really isn't that bad to use.
I had a look into my MT source code and decided I definitely don't want to add this
At least now... The reason is the MT code leaves better to be desired, and it becomes a total pain changing something...
Some.
First Trigger
TRIGGER
OWNERS: @P(1)
CONDITIONS:
Memory(19047, @AtLeast, 1)
Memory(19047, @AtMost, 31)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cantina"))
SetDeaths(@CurrentPlayer, @Set, 1, @U("Cave"))
PreserveTrigger()
Comment("")
ENDT
I had to make the first trigger manually because the way my looping works.
Second Trigger
FOR d = 0 TO 24574 BY 1 DO
This loops the three If then statements and the second trigger 24574 times
IF a <= e * 65536 + 2016 THEN a = a + 32 b = b + 1 ENDIF
"e" is Y in pixels. "a" is just my X and Y in pixels added together. I multiply "e", Y coordinate, by 65536 because that's how Stacraft stores the coordiantes.. I add 2016 because that is my max X coordinate in pixels. The statement fires when "a" is less than the maximum X and current Y are added together. When it fires it adds 32 X coordinate because I am doing this grid by tiles which is 32 pixels. "b" is also added showing the X is tiles.
IF a >= e * 65536 + 2047 THEN e = e + 1 a = 65536 * e b = 1 f = f + 1 ENDIF
This is the opposite of the previous If Then statement. When the X coordinate reaches the maximum of 2047 pixels is adds 1 to "e". Next we set up "a" to the next Y pixel, reseting it's X pixel. "b" is set back to the first X tile. Add we add 1 to "f".
IF f >= 32 THEN f = 0 c = c + 1 ENDIF
Once we have 32 "f" that means we moved to the next Y tile. Hence the 32 which represents 32 pixels. We set back "f" to 0 and add 1 to "c" which is the Y in tiles.
It may be a little confusing. I know that I am not very good at explaining, but I hope it helped.
None.
Oh, thanks! Now I see.
You could use the
REPEAT N <body>
ENDL construct instead of
FOR i
= 1 TO N <body>
ENDL if you don't need the loop variable i inside the loop <body>. You can also omit the "
BY 1" in
FOR-loop, it is implied by default. You use too many "magic numbers". One could have made it much clearer written like this:
// Memory offset to the variable v where SC stores order's coordinates.
// Variable v has size of a double word (4 bytes).
// Lower word is X coord and higher word is Y coord (in pixels):
// v = X + Y * 2^16,
// X = v % 2^16,
// Y = v / 2^16,
// where '%' and '/' are modulo and integer division operations accordingly.
INTEGER nOrderMemOffset = 19047
// Map dimenitions in tiles
INTEGER nXTileMax = 64
INTEGER nYTileMax = 24
// Tile width and height in pixels
INTEGER nTileWidth = 32
INTEGER nTileHeight = 32
UNIT dcXOut = @U("Cantina")
UNIT dcYOut = @U("Cave")
// Results in X tile and Y tile coordinates (0-based)
// written to dcXOut and dcYOut accordingly
FOR yPixel = 0 TO nYTileMax * nTileHeight - 1 DO
FOR xPixel = 0 TO (nXTileMax - 1) * nTileWidth - 1 BY nTileWidth DO
// SC resets v to 0 when no order is given, we don't detect 0
INTEGER delta = 1
IF (xPixel == nTileWidth) & (yPixel == 0) THEN delta = 0 ENDIF
TRIGGER
OWNERS: @P(1)
CONDITIONS:
Memory(nOrderMemOffset, @AtLeast, xPixel + delta yPixel * 2^16)
Memory(nOrderMemOffset, @AtMost, xPixel + (nTileWidth - 1) + yPixel * 2^16)
ACTIONS:
SetDeaths(@CurrentPlayer, @Set, xPixel % nTileWidth, dcXOut)
SetDeaths(@CurrentPlayer, @Set, yPixel % nTileHeight, dcYOut)
PreserveTrigger()
Comment("")
ENDT
ENDL
ENDL
This is self-explanatory even without comments. Am I right?
If you give the map, I can post this as an example of macro triggers at the first page.
EDIT:I've just realized it won't compile, because it is a hopeless endeavor to define a variable in a loop, but nevertheless...
Of course, this is easy to fix, but who cares now?..
Post has been edited 8 time(s), last time on Aug 23 2009, 12:23 pm by Wormer. Reason: Realized I made an error
Some.
Hey guys, I would really like to use this tool but my programming knowledge stops at Basic. Basic language will get me through learning this trigger language, but I cannot get the program open for the life of me.
I have read every post and have tried to get this program to run for the last 2 hours. I need to know exactly what to type in to get the jarfile to be accessed. I downloaded java environment and should be good to go there.
My command line is this:
C:\Users\Bearcat>java -jar C:\Program Files\Starcraft\Macro Trigger\mtrigsc.jar C:\Program Files\Starcraft\Macro Trigger\source.mtrigger
Also tried:
C:\Users\Bearcat>java -jar C:\Program Files\Starcraft\Macro Trigger\mtrigsc.jar C:\Program Files\Starcraft\Macro Trigger\source.mtrigger out.trigger out.property
When I hit enter, it says:
Unable to acces jarfile C:\users\bearcat\Program
I named an example trigger Source.mtrigger. From reading the posts, am I suppose to have a source.mtrigger file? I don't get what source.trigger, out.trigger, and out.property work when starting this.
Call me stupid, but I can't figure this out. I really appreciate any help and I would really like to use this tool for the RPG competition.
EDIT POST: Okay, so I used quotes and got it to say MacroTriggers Compilier v1.4 and then it gives another command line. I guess I need SCMD editor first to get triggers to start with? This is way confusing.....I am not in the loop.
EDIT AGAIN: So I downloaded SCM Draft and started playing with the text editor. I think this is all I need since I can create triggers in Excel and copy them in. I will see if I can't use your program if I can figure it out
~
Thanks,
bearcat_fan
Post has been edited 2 time(s), last time on Aug 15 2009, 3:55 am by bearcat_fan.
None.
bearcat_fan, yes you almost did it!
When you got the line saying "MacroTriggers Compilier v1.4" it means mtrigs worked out on your source.mtrigger file successfully and that you got output files created by the program. The only thing you left to do is to look for files out.trigger and out.property in the current folder which was "C:\Users\Bearcat". If there was something in your source.mtrigger file then you'll see some SCMD triggers in the file out.trigger and can copy/paste them into the SCMD text editor (yes, this how it works).
Also, could you tell me what system do you use? Is it XP or Vista? Because recently there were problems with writing to the programs folder on Vista (probably).
Post has been edited 2 time(s), last time on Aug 15 2009, 7:03 am by Wormer.
Some.
After pressing Ctrl + F6 after finishing my triggers, how do I find where the output of the triggers were?
Also, could locations be done like this? :
RemoveUnitsAt(@All, v3, @AllPlayers, @L("
a(2^n)")
I want the location "number" to be increased by 1 everytime, so it would be like this:
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
Also:
MacroTriggers Compiler v1.4
BR.recoverFromMismatchedToken
in C:\Users\LOL\Desktop\Starcraft Map Making\MacroTriggers v1.4\RandomDefense2.mtrigger:line 0:-1: mismatched input '<EOF>' expecting 'ENDL'
Thanks in advance.
Post has been edited 1 time(s), last time on Aug 19 2009, 2:06 am by NothingZ.
None.