Staredit Network > Forums > SC1 Mapping Tools > Topic: MacroTriggers production thread
MacroTriggers production thread
May 16 2008, 10:36 pm
By: Wormer
Pages: < 1 « 2 3 4 5 615 >
 

Jun 27 2009, 6:48 am Wormer Post #61



Commanda_Panda, this program can be used to duplicate triggers. For example, to duplicate your triggers you need to write the next text into a text file:
Quote
PLAYER aPlayer = @F("Players")

FOR n = 1 TO 100 DO
TRIGGER
OWNERS: aPlayer
CONDITIONS:
Deaths(@CurrentPlayer, @AtLeast, n, @U("Terran Missile Turret"))
ACTIONS:
ModifyUnitProperty(@Hitpoints, @All, @U("SCMD Unit Name Here"), @CurrentPlayer, @Anywhere, n)
ENDT
ENDL
After that done, you run this program on your text file and it generates triggers in SCMD text triggers syntax for you which you copy-paste whenever you want.

This program is something more than a simple duplicator. It is not designed to use it like "duplicate and forget". One benefits more if he writes whole triggers this way. The program suggests a style of triggering only in text, when it becomes easier to maintain medium and large maps later. It is also easier to understand a well-written triggers if they written in MacroTriggers mostly because they represented in much more compact way.

EDIT:
This program has much more powerful capabilities in duplicating triggers than TriggerDuplicator. TriggerDuplicator won't go if you need to duplicate anything little bit more complex than trivia. For example, many maps use binary countoffs where duplicated numbers should go as powers of two, which one can't do with TriggerDuplicator (because values TriggerDuplicator can do have constant difference). Also, with TriggerDuplicator I don't know (I believe it is impossible, if I'm wrong please correct me) how to specify the place where duplicated triggers are inserted.

Post has been edited 5 time(s), last time on Jun 27 2009, 7:20 am by Wormer.



Some.

Jun 27 2009, 8:50 pm Morphling Post #62



I looked at this again and I saw how great this is. I just followed your instructions and it worked flawlessly. Great job! :D
Edit: I can't get the auto completion of conditions and actions to work. :crazy:
Edit: Nevermind. I got it to work.

Edit: My only complaint atm is that it is case sensitive. :><: , but it's still really nice.

Post has been edited 5 time(s), last time on Jun 28 2009, 3:30 am by Morphling.



None.

Jun 28 2009, 7:21 pm Conspiracy Post #63



I've come a long way, and to my senses thanks to Morphling.

I finally got it to work, somewhat. I can't make my own. When I try to make one, it comes up blank. Here is what I did:

Code
FOR a=31 TO 0 BY -1 DO
    TRIGGER
    OWNERS: @P(1)
    CONDITIONS:
        Deaths(@CurrentPlayer, @AtLeast, 2^a, @U("Terran Marine")
    ACTIONS:
        SetResources(@CurrentPlayer, @Add, 2^a, @Ore)
    ENDT
ENDL


See anything wrong w/ it?

Also, here are a few things I don't like about it (Though, I don't know if you can fix them):

- Case Sensitive. I'm lazy, I don't want to have to hold the shift, or toggle Caps Lock. :P
- The quotes are required ( " " ). Everyone loves ( ' ' ) better than they do ( " " ).
- Are @'s really required? Or can we just do something similar to UNIT p = @P(1), but for triggers?

My post, that you commented on about tabs, I wasn't clear, and that is my fault. What I meant is something like this:

{Players go here. CP for Current Player F1, F2, F3, F4, etc.}
(1 Space or 1 Tab, to signify that these are conditions) {Conditions. Separated by return}
(2 Spaces, 2 Tabs, or some other combination, just to signify actions) {Actions. Separated by return}

Would look like:
Code
P1 // Player one
 Always() // Always
  setresources(CP, Add, 1) // Set Resources for Current Player, add 1

(Condition is supposed to have 1 space, and action is supposed to have 2. Just 1 doesn't show up for some reason.)

I don't know how java works, as I haven't delved deep into the world of programming, so tell me if that wouldn't work, and if you so politely could, explain?

Other than that, I love the compatibility to turn a few lines into binary count offs with little to no effort, and I prefer typing than I do clicking, so that is another plus.

Post has been edited 3 time(s), last time on Jun 28 2009, 7:33 pm by Conspiracy.



None.

Jun 28 2009, 10:32 pm Wormer Post #64



First of all, thank you for feedback!

Conspiracy, I got the next error when trying to compile your triggers:
Quote
line 6:4 mismatched input 'ACTIONS' expecting ')'
Your code has a single error in the line
Quote
Deaths(@CurrentPlayer, @AtLeast, 2^a, @U("Terran Marine"))
It compiled fine for me when I fixed it.


Quote from Morphling
Edit: My only complaint atm is that it is case sensitive. :><: , but it's still really nice.
Quote from Conspiracy
- Case Sensitive. I'm lazy, I don't want to have to hold the shift, or toggle Caps Lock. :P
Most of the programming languages I used to work with are case sensitive (like those well known Java, C, Pascal and many others). That why I made my language case sensitive too. I feel myself more comfortable when the language is case sensitive.

I could fix that by allowing users to define their own actions and conditions, so anyone can rename them as they like. Keywords (like FOR, TRIGGER, ENDIF) are written in capital letters because it was my initial language design decision and I'm not going to change it now.

Quote from Conspiracy
- The quotes are required ( " " ). Everyone loves ( ' ' ) better than they do ( " " ).
Programming languages I work with usually use double quotes for strings, that why I made it double quotes too.

Quote from Conspiracy
- Are @'s really required? Or can we just do something similar to UNIT p = @P(1), but for triggers?
@'s in names of special functions and constants were added intentionally. This symbol is intended to distinguish embedded names from user defined ones and reminds one he uses special "functions".

Quote from Conspiracy
My post, that you commented on about tabs, I wasn't clear, and that is my fault. What I meant is something like this:

{Players go here. CP for Current Player F1, F2, F3, F4, etc.}
(1 Space or 1 Tab, to signify that these are conditions) {Conditions. Separated by return}
(2 Spaces, 2 Tabs, or some other combination, just to signify actions) {Actions. Separated by return}
I get what you meant. Usually in programming languages tabs and newline characters count as spaces to let user format his code as he likes. I have an opinion that tabs and new lines should not have any other semantic meaning other than dividing words from each other.

Quote from Conspiracy
I don't know how java works, as I haven't delved deep into the world of programming, so tell me if that wouldn't work, and if you so politely could, explain?
That would work, and I could do it, but I'm not intended to do this because this deviates with common practices of language design. And everything that is not a common sense should be excluded. I am also interested what others think about this.


About that promised array thing. I've already implemented it, but got a nasty error which I should fix.

Post has been edited 3 time(s), last time on Jun 28 2009, 10:40 pm by Wormer.



Some.

Jun 28 2009, 11:01 pm Falkoner Post #65



Wormer, if it'd be possible, I think you should remove the case-sensitivity, however, whenever the triggers are compiled, you should put everything in the proper case, that would make it very easy to work with.



None.

Jun 28 2009, 11:52 pm Conspiracy Post #66



Quote from Wormer
Quote
line 6:4 mismatched input 'ACTIONS' expecting ')'

Your code has a single error in the line
[quote]
Deaths(@CurrentPlayer, @AtLeast, 2^a, @U("Terran Marine"))

Odd. When I did that, exactly as you said, placed an additional ) at the end, and compiled, it still doesn't work (as in still a blank screen).

Also, I do not get that error. I only get:

[quote]
CreateProcess() failed with error code 2:
The system cannot find the file specified.

Quote from Wormer
Most of the programming languages I used to work with are case sensitive (like those well known Java, C, Pascal and many others). That why I made my language case sensitive too. I feel myself more comfortable when the language is case sensitive.

I could fix that by allowing users to define their own actions and conditions, so anyone can rename them as they like. Keywords (like FOR, TRIGGER, ENDIF) are written in capital letters because it was my initial language design decision and I'm not going to change it now.

I understand. I personally don't like typing in 'TRIGGER', 'OWNERS:', 'CONDITIONS:', 'ACTIONS:', but that is why people invented the macro :)

Quote from Wormer
Programming languages I work with usually use double quotes for strings, that why I made it double quotes too.

Have you ever done HTML? It doesn't require the use of double quotes, just single.

Quote from Wormer
@'s in names of special functions and constants were added intentionally. This symbol is intended to distinguish embedded names from user defined ones and reminds one he uses special "functions".

Ok, I understand, just part of the language. I just hate pressing shift, and reaching for 2.


Quote from Wormer
That would work, and I could do it, but I'm not intended to do this because this deviates with common practices of language design. And everything that is not a common sense should be excluded. I am also interested what others think about this.

I thought new was good? I too am interested in what people thing of this, because I was going to attempt to make a program that did similar to what yours does, except in an .exe format, so you don't have to do as much as yours, rather just double click the program and go.

PS: No problem, I love testing things, it lets me point out flaws and give feedback. If you ever want a test for pretty much anything (as long as it doesn't harm my computer ;)), just give me PM, and i'll test it ;)



None.

Jun 29 2009, 11:32 am Wormer Post #67



Quote from Conspiracy
Odd. When I did that, exactly as you said, placed an additional ) at the end, and compiled, it still doesn't work (as in still a blank screen).

Also, I do not get that error. I only get:

Quote
CreateProcess() failed with error code 2:
The system cannot find the file specified.
It seems the problem is you put wrong path to the mtrigsc.jar file. Do you use Notepad++ to compile triggers? If checking the path to mtrigsc won't help, could you post the script you execute to run MacroTriggers?

Quote from Conspiracy
I understand. I personally don't like typing in 'TRIGGER', 'OWNERS:', 'CONDITIONS:', 'ACTIONS:', but that is why people invented the macro :)
If you programmed on Pascal, don't you tired of typing "BEGIN", "END", "FOR" and etc. or "class", "public", "private" in Java? It is much easier to type TRIGGER and FOR one time than copying triggers manually.

These keywords are made for sake of better visual representation. I could have made triggers syntax like that:
Quote
TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)

TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
The program could easily tell when owners finish and conditions start (the point of occurrence of the first condition), and when conditions finish and actions start (the point of occurrence of the first action). The trigger finishes when the next trigger starts. But if one won't consistently hold special formatting rules, reading triggers like that would be difficult for others. By introducing keywords OWNERS, CONDITIONS, ACTIONS, ENDT I suggested a uniform formating style. One can like it or not, but to my mind this is better than having tens of different coding styles. For example one can format triggers above like this:
Quote
TRIGGER
// OWNERS
pGameMaster
// CONDITIONS
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
// ACTIONS
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)
//REGGIRT

TRIGGER
// OWNERS
pGameMaster
// CONDITIONS
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
// ACTIONS
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
// REGGIRT
Noone will tell him, he put the ACTIONS comment in the second trigger the wrong place. And another man could format triggers like this:
Quote
TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)

TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
No one will tell him he put wrong tabbing in the first trigger for the Opponents condition. The third man could invent his own formatting style. What will we have in the end?

I even could have made players, conditions and actions go in arbitrary order in the trigger, when conditions and actions order is defined by their relative order to the other conditions or actions independently. The first trigger could have been written then like this:
Quote
TRIGGER
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
pGameMaster
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)
Opponents(pGameMaster, @Exactly, 1)
But it would have been a total pain reading triggers formatted like this.

Quote from Falkoner
Wormer, if it'd be possible, I think you should remove the case-sensitivity, however, whenever the triggers are compiled, you should put everything in the proper case, that would make it very easy to work with.
Okay, if you don't like case sensitivity so much... But changing it now could affect already written triggers. I'll leave it as it is for now, but later I could consider developing another language which won't have so much nasty capital letter keywords, will be case insensitive and won't contain '@' characters. Just to clearfy, case insensitivity would mean every identifiers or keywords distinguishing only in letters size will be the same (for example @AtLeast, @atleast, @ATLEAST, @aTleAsT would be considered the same).

Quote from Conspiracy
Have you ever done HTML? It doesn't require the use of double quotes, just single.
HTML allows you to write strings in both ways "string" or 'string'. This is done that one could specify double (or single) quotes inside strings easily using the other quotation character to designate the start and the end of the string... But... ermmmrrr, you know... I've just looked into my code and made a discovery! LOL. You can already use html-like strings in MacroTriggers. Period.

Quote from Conspiracy
I thought new was good? I too am interested in what people thing of this, because I was going to attempt to make a program that did similar to what yours does, except in an .exe format, so you don't have to do as much as yours, rather just double click the program and go.
Of course not always "new is good". Okay, good luck with your program, but as a system programmer I can tell you that usually real compilers are done as executable files which are invoked solely from command line. Then Integrated Development Environments (IDE) provide text editor (and what not) and invoke those compiler.exe files themselves hiding the command line interface from the user. I believe this is done to make a layer of abstraction between the compiler and the IDE, because these are two totally distinguishing programs. I have no time and experience in developing such IDEs. I consider Notepad++ my IDE for MacroTriggers. I know writing from scratch is very interesting, but if you like to really help you better write a text editor which will have syntax highlighting similar to Notepad++, syntax hints for actions and conditions, and will hide invoking of the mtrigc compiler from the user behind a nice looking button. I can tell, this is not an easy task to make it right.

Post has been edited 2 time(s), last time on Jun 29 2009, 12:28 pm by Wormer.



Some.

Jun 29 2009, 2:02 pm Wormer Post #68



MacroTriggers supports arrays!

Finally I've released the version 1.4 which supports arrays, you can find the link in the first post.

One can write
Quote
INTEGER Green = 5
ARRAY colors = { "Red", Green, "Blue", @CustomDisplay, @AlwaysDisplay, "Green" }

TRIGGER
OWNERS: @P(12)
CONDITIONS:
ACTIONS:
DisplayText(colors[0], @AlwaysDisplay)
DisplayText(colors[colors[1]], colors[3])
DisplayText(colors[2], colors[4])
ENDT
and get the result
Quote
Trigger("Player 12") {
Conditions:
Actions:
Display Text Message(Always Display, "Red");
Display Text Message(Don't Always Display, "Green");
Display Text Message(Always Display, "Blue");
}




Some.

Jun 29 2009, 2:59 pm Conspiracy Post #69



Quote from Wormer
It seems the problem is you put wrong path to the mtrigsc.jar file. Do you use Notepad++ to compile triggers? If checking the path to mtrigsc won't help, could you post the script you execute to run MacroTriggers?

path to mtrigsc: C:\v1.3\mtrigsc.jar. Yes, I do use Notepad++ to compile.

The code I use:

Code
cd "$(CURRENT_DIRECTORY)" // set up current directory
NPP_SAVE // save current file
java -jar "C:\v1.3\mtrigsc.jar" "$(FULL_CURRENT_PATH)" "$(NAME_PART).trigger" "$(NAME_PART).property"
//NPP_CLOSE "$(NAME_PART).property"
//NPP_OPEN "$(NAME_PART).property"
NPP_CLOSE "$(NAME_PART).trigger" // to make notepad++ reload file we close it
NPP_OPEN "$(NAME_PART).trigger"


Pretty much the same one Falkoner posted, except I changed the directory to mstrigsc.jar.

Quote from Wormer
If you programmed on Pascal, don't you tired of typing "BEGIN", "END", "FOR" and etc. or "class", "public", "private" in Java? It is much easier to type TRIGGER and FOR one time than copying triggers manually.

Ok, so when I get into the programming world, I will have to do something similar then? Just one more question about those (TRIGGER, OWNERS:, etc.), are they case sensitive?

Quote from Wormer
These keywords are made for sake of better visual representation. I could have made triggers syntax like that:
Quote
TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)

TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
The program could easily tell when owners finish and conditions start (the point of occurrence of the first condition), and when conditions finish and actions start (the point of occurrence of the first action). The trigger finishes when the next trigger starts. But if one won't consistently hold special formatting rules, reading triggers like that would be difficult for others. By introducing keywords OWNERS, CONDITIONS, ACTIONS, ENDT I suggested a uniform formating style. One can like it or not, but to my mind this is better than having tens of different coding styles. For example one can format triggers above like this:
Quote
TRIGGER
// OWNERS
pGameMaster
// CONDITIONS
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
// ACTIONS
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)
//REGGIRT

TRIGGER
// OWNERS
pGameMaster
// CONDITIONS
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
// ACTIONS
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
// REGGIRT
Noone will tell him, he put the ACTIONS comment in the second trigger the wrong place. And another man could format triggers like this:
Quote
TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Opponents(pGameMaster, @Exactly, 1)
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)

TRIGGER
pGameMaster
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
Bring(pMacro1, @AtLeast, 1, @Buildings, lT1Start)
Bring(pMicro1, @AtLeast, 1, @Buildings, lT1Upgrades)
Bring(pMacro2, @AtLeast, 1, @Buildings, lT2Start)
Bring(pMicro2, @AtLeast, 1, @Buildings, lT2Upgrades)
SetDeaths(pGameMaster, @Set, nGmodMM, dcGameMode)
No one will tell him he put wrong tabbing in the first trigger for the Opponents condition. The third man could invent his own formatting style. What will we have in the end?

I even could have made players, conditions and actions go in arbitrary order in the trigger, when conditions and actions order is defined by their relative order to the other conditions or actions independently. The first trigger could have been written then like this:
Quote
TRIGGER
SetDeaths(pGameMaster, @Set, nGmodSingle, dcGameMode)
Deaths(pGameMaster, @Exactly, nGmodUnknown, dcGameMode)
SetDeaths(@Foes, @Set, nMsgSingleUnderConstruction, dcDisplayMessage)
Wait(0)
pGameMaster
SetDeaths(@Foes, @Set, nMsgMapStats, dcDisplayMessage)
Opponents(pGameMaster, @Exactly, 1)
But it would have been a total pain reading triggers formatted like this.

So, you put them in for ascetics, making it easier to read and understand? If you did do it for ascetics, could you theoretically make a way to format it in the ascetically pleasing way, but you write them in a non ascetically pleasing way?

Pretty much all I am trying to get at is time, and preventing Carpal Tunnel Syndrome ;)

Quote from Wormer
Okay, if you don't like case sensitivity so much... But changing it now could affect already written triggers. I'll leave it as it is for now, but later I could consider developing another language which won't have so much nasty capital letter keywords, will be case insensitive and won't contain '@' characters. Just to clearfy, case insensitivity would mean every identifiers or keywords distinguishing only in letters size will be the same (for example @AtLeast, @atleast, @ATLEAST, @aTleAsT would be considered the same).

That would be great. That would make it easier, and I think more productive.

Quote from Wormer
HTML allows you to write strings in both ways "string" or 'string'. This is done that one could specify double (or single) quotes inside strings easily using the other quotation character to designate the start and the end of the string... But... ermmmrrr, you know... I've just looked into my code and made a discovery! LOL. You can already use html-like strings in MacroTriggers. Period.

:/ It didn't work when I was compiling the triggers, but ok :P

Quote from Wormer
Of course not always "new is good". Okay, good luck with your program, but as a system programmer I can tell you that usually real compilers are done as executable files which are invoked solely from command line. Then Integrated Development Environments (IDE) provide text editor (and what not) and invoke those compiler.exe files themselves hiding the command line interface from the user. I believe this is done to make a layer of abstraction between the compiler and the IDE, because these are two totally distinguishing programs. I have no time and experience in developing such IDEs. I consider Notepad++ my IDE for MacroTriggers. I know writing from scratch is very interesting, but if you like to really help you better write a text editor which will have syntax highlighting similar to Notepad++, syntax hints for actions and conditions, and will hide invoking of the mtrigc compiler from the user behind a nice looking button. I can tell, this is not an easy task to make it right.

You have a valid point, but I look at as a matter of simplicity. Yours requires the command line, when in fact, I won't really have to have to use the command line, so it won't hide behind a fancy button (and I prolly won't even have any buttons). I don't have much (if any) experience with IDE's, so I will be forced to write from scratch, or spend a while figuring out how Notepad++ works with syntax highlighting, and how I could get it compatible with the program I will be using to write the compiler. (AutoIt v3.3.0.0, its C++ derivative bent on scripts, but has other capabilities). If Notepad++ can open an .exe, then I would be pretty set.



None.

Jun 29 2009, 3:53 pm Falkoner Post #70



Quote from Wormer
MacroTriggers supports arrays!

Finally I've released the version 1.4 which supports arrays, you can find the link in the first post.

One can write
Quote
INTEGER Green = 5
ARRAY colors = { "Red", Green, "Blue", @CustomDisplay, @AlwaysDisplay, "Green" }

TRIGGER
OWNERS: @P(12)
CONDITIONS:
ACTIONS:
DisplayText(colors[0], @AlwaysDisplay)
DisplayText(colors[colors[1]], colors[3])
DisplayText(colors[2], colors[4])
ENDT
and get the result
Quote
Trigger("Player 12") {
Conditions:
Actions:
Display Text Message(Always Display, "Red");
Display Text Message(Don't Always Display, "Green");
Display Text Message(Always Display, "Blue");
}

This just really makes me realize how much you need to add loops inside of triggers, if you could loop actions, you'd only need 1 Display Text Message, and then you could change which member of the array was being used.



None.

Aug 3 2009, 10:43 pm The Starport Post #71



Does this allow multiple source files to be compiled into one? I can't seem to get Notepad++ macros to work copy and pasting source files together correctly.

I may just cook up a quickie application to do that myself, if not.

Post has been edited 2 time(s), last time on Aug 4 2009, 10:42 am by Tuxedo-Templar.



None.

Aug 4 2009, 1:35 am Falkoner Post #72



I'm going to start using this next week to begin production on Mystic Islands RPG, so if you have any last second ideas, I'd appreciate it if you add them in soon :) Also, does the array function allow for locations? Because that could be so useful.. Or does it just basically insert whatever text you place in the array?

EDIT: Oh, and also, I was thinking, and this may be a bit too ridiculously hard, but it would be AWESOME if you allowed for use of variables inside of strings, like, I could have a Display Text Message(Always Display, "You have " + n + "babies left to eat"); And so it would output different strings, variably, this in conjunction with arrays would be hawt.

Also, about the Arrays, can you use variables to point to which member in the array is being used, like, can I have colors[n]?

And once again, I'd like to put in a request for loops inside of triggers, other than that, I'm fine with how it currently is, and great job so far :)

Post has been edited 2 time(s), last time on Aug 4 2009, 7:45 am by Falkoner.



None.

Aug 4 2009, 3:38 pm Wormer Post #73



Quote from name:Tuxedo-Templar
Does this allow multiple source files to be compiled into one? I can't seem to get Notepad++ macros to work copy and pasting source files together correctly.

I may just cook up a quickie application to do that myself, if not.
Like an #include in C? Um.. no, there is not ^^ I also wanted to add that feature (and tons of other things) but haven't done it.

Quote from Falkoner
I'm going to start using this next week to begin production on Mystic Islands RPG, so if you have any last second ideas, I'd appreciate it if you add them in soon :)
I got tons of different ideas going round in disorder in my head. I don't know whether I find strength within myself to overcome my laziness to make something useful. Though the prior thing I see is adding conditionals and loops within Actions and Conditions.

Quote from Falkoner
Also, does the array function allow for locations? Because that could be so useful.. Or does it just basically insert whatever text you place in the array?
It allows locations. It inserts the object (not text) which results from the expression evaluation. So, you can feel free to put locations there. No one constrains you from mixing objects of different types in one array like in the example above.

Quote from Falkoner
like, I could have a Display Text Message(Always Display, "You have " + n + "babies left to eat");
You can already use that. Though I forget whether you can use Units and other objects there instead of n... But integers of course are the most useful there.

Quote from Falkoner
Also, about the Arrays, can you use variables to point to which member in the array is being used, like, can I have colors[n]?
Yes, you can.



Some.

Aug 4 2009, 8:09 pm Falkoner Post #74



Quote
You can already use that. Though I forget whether you can use Units and other objects there instead of n... But integers of course are the most useful there.

Really? Is it like I said, or is the syntax different?



None.

Aug 4 2009, 10:31 pm The Starport Post #75



Quote from Wormer
Quote from name:Tuxedo-Templar
Does this allow multiple source files to be compiled into one? I can't seem to get Notepad++ macros to work copy and pasting source files together correctly.

I may just cook up a quickie application to do that myself, if not.
Like an #include in C? Um.. no, there is not ^^ I also wanted to add that feature (and tons of other things) but haven't done it.
Well it's no biggie. I've found a few alternatives already that work just fine for me.



None.

Aug 5 2009, 12:04 am The Starport Post #76



Edit: My bad. Solved it myself. :P


Also, I had to do the following to get the Execute command working properly:
Code
java -jar "<MT's directory>\v1.4\mtrigsc.jar" "$(FULL_CURRENT_PATH)" "<Project folder>\$(NAME_PART).trigger" "<Project folder>\$(NAME_PART).property"
NPP_OPEN "<Project folder>\$(NAME_PART).property"
NPP_OPEN "<Project folder>\$(NAME_PART).trigger"

Otherwise I keep getting the following error:
Code
Exception in thread "main" java.io.FileNotFoundException: trig.trigger (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.PrintStream.<init>(Unknown Source)
    at ru.mtrigs.MTrigs.main(MTrigs.java:53)


Post has been edited 2 time(s), last time on Aug 5 2009, 5:53 am by Tuxedo-Templar.



None.

Aug 5 2009, 8:37 am Wormer Post #77



Quote from Falkoner
Really? Is it like I said, or is the syntax different?
Exactly like you said! Concatenating strings have one more handy usage when you want to arrange the displayed text by lines in sources like it will be shown in SC.

For example, one may write the next action to display map information in the game.
DisplayText(
" \x01fMap Stats\r\n" +
"\x003Mapname: " + sMapname + " \x004v" + sVersion + " \x002(" + sModifyDate + "\x002)\r\n" +
"\x003Filename: " + sFilename + "\r\n" +
"\x003Terrain mapname: " + sTerrainMapname + " \x004v" + sTerrainVersion + "\r\n" +
"\x003Terrain info: " + sTileset + " " + sDimenitions + "\r\n" +
"\x003Mapsize: " + sMapsize + "\r\n" +
"\x003Other info: " +
sTriggersNumber + " \x002triggers, " +
sLocationsNumber + " \x002locations, " +
sStringsNumber + " \x002strings" + "\r\n",
@AlwaysDisplay)



Quote from name:Tuxedo-Templar
Also, I had to do the following to get the Execute command working properly:
Code
java -jar "<MT's directory>\v1.4\mtrigsc.jar" "$(FULL_CURRENT_PATH)" "<Project folder>\$(NAME_PART).trigger" "<Project folder>\$(NAME_PART).property"
NPP_OPEN "<Project folder>\$(NAME_PART).property"
NPP_OPEN "<Project folder>\$(NAME_PART).trigger"

Otherwise I keep getting the following error:
Code
Exception in thread "main" java.io.FileNotFoundException: trig.trigger (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.PrintStream.<init>(Unknown Source)
    at ru.mtrigs.MTrigs.main(MTrigs.java:53)
Hrmmm... :ermm: Strange. It works from the current folder well for me...

EDIT:
By the way, the last two parameters are optional. You could not specify them at all, then two files out.trigger and out.property are created in the current directory.

Post has been edited 2 time(s), last time on Aug 5 2009, 8:48 am by Wormer.



Some.

Aug 5 2009, 8:42 am Falkoner Post #78



One last question, does white space matter, with any of the functions, or does it simply ignore it?

Quote
Hrmmm... :ermm: Strange. It works from the current folder well for me...

It also works fine for me :|



None.

Aug 5 2009, 8:46 am Wormer Post #79



Quote from Falkoner
One last question, does white space matter, with any of the functions, or does it simply ignore it?
White spaces, tabs and EOLs (End Of Line) are ignored everywhere between tokens (keywords, identifiers, operation symbols and literals)



Some.

Aug 6 2009, 3:14 pm The Starport Post #80



Is there a way to add in conditions or actions inside in an existing trigger via a loop or MACRODEF or something equivalent?

I'll feel dirty if I have to continue doing this with my current hack-o-licious regex find & replace NP++ macros. :P

Quote from Wormer
Hrmmm... :ermm: Strange. It works from the current folder well for me...

EDIT:
By the way, the last two parameters are optional. You could not specify them at all, then two files out.trigger and out.property are created in the current directory.
It might be because of some Vista security crap preventing file output into a Program Files directory or something retarded like that. Probably not your fault, in that case. :P

Post has been edited 3 time(s), last time on Aug 6 2009, 6:14 pm by Tuxedo-Templar.



None.

Options
Pages: < 1 « 2 3 4 5 615 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
Please log in to shout.


Members Online: Roy, Ingol82, NudeRaider, Zycorax, C(a)HeK