[skip all navigation]

Oreo Triggers, A new trigger preprocessor

Pages: < 1 2 3 4 >
Creator: Kaias
Time: Jun 2 2012, 9:22 am

Post #21     TF- Jun 13 2012, 6:34 am

[Avatar]
*screams internally*
offlinecontact
Rank: Member
Looks cool, do you keep a list of 'unused/useless units' to automatically use in those timers? Might be useful to know what's on it.

Top

Post #22     Jack[RCDF Jun 13 2012, 6:47 am

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
Quote from TF-
Looks cool, do you keep a list of 'unused/useless units' to automatically use in those timers? Might be useful to know what's on it.
There's a list in one of the files in the Oreos folder, I forget which file. I was told there's a way to set aside already-in-use DCs too so you can use Oreos on a map that's already started without screwing up your existing triggers. Having said that, I think it is much easier to code a map from scratch using this or Macrotriggers or similiar than it is to add on to an existing map.

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #23     Kaias Jun 16 2012, 10:44 pm

[Avatar]
offlinecontact
Rank: Veteran
The UnitGroup Class:

The UnitGroup class is a combination of three things: a Player, a Unit, and a Location. I noticed that most of the actions and conditions combined these three things, so I figured there should be a class for it for simplification. Example of declaring a UnitGroup:
	$npcs = new UnitGroup("Terran Civilian", "Player 7", "Town");

This would create a new UnitGroup object (named $npcs) for Player 7's Terran Civilians that are in location "Town". How is this useful? It simplifies a lot of your syntax and adds modularity (if you decide you want change it to Medics, for instance, you only need to change it in the declaration instead of hunting down every instance).

Lets say player 1 has a hero unit, Jim Raynor, and we want to have 7 hydras come out of the ground and attack him when he enters a location called "Ambush". We could do that like this:
	// Trigger Owner
$P1 = new Player(P1);

// Locations
$ambushloc = new Location("Ambush");
$main = new Location("_Main"); // _Main is a general purpose location I put in all of my maps

// Unit Groups
$hero = new UnitGroup("Jim Raynor (Marine)", P1, Anywhere); // There's only one jim raynor in our entire map so I'm just using the Anywhere location
$hydras = new UnitGroup("Zerg Hydralisk", P8, $ambushloc);

// The Actual trigger
$P1->_if( $hero->at($ambushloc) )->then_justonce(
$hydras->create(7, Burrowed),
$hero->acquireLocation($main),
$hydras->patrolTo($main),
'');


+
Generated Result


Obviously making all those objects just for one trigger is excessive, but realistically in a map you'll be using those variables all the time.

+
All UnitGroup Methods


Top

Post #24     Kaias Jun 17 2012, 11:11 pm

[Avatar]
offlinecontact
Rank: Veteran
New Update 0.8.5:
  • Added ->isMatrixed(), ->isStimmed(), ->isEnsnared(), ->isLockedDown(), ->isMaelstromed(), and ->isBlind() to the IndexedUnit Class.
  • Fixed a few bugs.
  • Added switch statements to the Oreo Syntax. Example:
    (user posted image)
    The statement would be analogous to
    (user posted image)
  • Added ->at(location) condition to UnitGroup Class.
  • Added ->signedSubtraction($dc, $signSwitch), ->absDifference($var1, $var2, $signSwitch), ->distance($x,$y), ->distance($x1, $y1, $x2, $y2), ->squared($var) functions to the Deathcounter Class
  • Added Trigger Analysis. If you add ShowAnalysis(); after you initialize, then on compile it will tell you how many triggers each Oreo trigger is generating. Example:
    (user posted image)
    then if you wrap oreo actions in analyze(), it will tell you how many triggers the action(s) is/are generating. Example:
    (user posted image)

Download Link:
http://www.mediafire.com/?i2ge65z9fpa8lof

Next Up:
Timer class, and UnitGroup ->enters(location) and ->exits(location) functions

Top

Post #25     Oh_Man Jun 19 2012, 8:50 pm

[Avatar]
Creation is the province of man.
offlinecontact
Rank: Regular
This should be front-paged. Admins - make this a priority.

Top

Post #26     Jack[RCDF Jun 20 2012, 9:45 pm

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
Quote from Oh_Man
This should be front-paged. Admins - make this a priority.
You're welcome to make a post in Portal News; if it's deemed acceptable it will be on the front page.

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #27     Kaias Jun 27 2012, 12:18 am

[Avatar]
offlinecontact
Rank: Veteran
New Update 0.9.0: Mint Oreos

After some collaboration with yoonkwun (thanks yoonkwun), we developed an extension called 'Mint', which lets you write triggers to your map merely by compiling. With Mint enabled, you no longer have to copy/paste the generated text into Scmdraft, the triggers are added for you. This also gives you the ability to generate units and locations to your map within Oreo trigs.

Using Mint:
To start, you must provide a path to your input file and an output file path to the Mint() function. Ex:
(user posted image)
Mint takes your input map file and adds the triggers Oreo generates to it. Your input map should not have the triggers in it. There are few reasons we do it this way instead of overwriting the triggers onto the original file- it protects your map from the off chance that it gets corrupted, it keeps the triggers units and locations (made by OT) from being added to your map multiple times, and it makes it so that you don't have to reload the map in Scmdraft after compiling.
Your typical work flow would go like this- keep the original/input map open in Scmdraft (for making physical changes to the map, like terran, units, sprites) and oreo triggers in whatever IDE your using (for making changes to the triggers). Whenever you make a change to the map in either Scmdraft or in Oreo Trigs, you recompile OT and the changes will appear in the output map. When you test in Starcraft, you test with your output map file (where all the physical map and triggers are combined).

To create a preplaced unit or location to the map using Mint Oreos, simply use these functions:
(user posted image)

Change Log:
  • You can now specify (in config.php) the switches that Oreo trigs is allowed to use.
  • Renamed LeaderBoard to LeaderBoardPoints
  • Added UnitGroup notAt(), inside() and outside() functions
  • Added Gas() and Ore() Conditions
  • Finished adding all standard conditions:
    - Kill
    - CommandTheLeast
    - CommandTheLeastAt
    - CommandTheMost
    - CommandTheMostAt
    - LowestScore
    - HighestScore
    - LeastKills
    - MostKills
    - LeastResources
    - MostResources
    - Opponents
  • Made it so that if you try to center a location on multiple players it gives an error
  • Several bug fixes

Download Link:
http://www.mediafire.com/?314bqvc3dww5mle

Next Up:
Timer class, and UnitGroup ->enters(location) and ->exits(location) functions, Deathcounter Storage class.
This post was edited 1 time, last edit by Kaias: Jun 27 2012, 3:29 am.

Top

Post #28     CecilSunkure Jun 27 2012, 12:38 am

[Avatar]
offlinecontact
Rank: Veteran
Hey this is pretty cool. I need a project to practice some programming this summer to stay sharp, and I may want to dabble in something like this as well... We'll have to see.

I'm mostly interested in how you place triggers into the map file. Is there documentation somewhere on the file format of starcraft scenario files? Pretty interesting as I just developed something similar: LINK.

Also, is the source included in the download or anywhere else?

Lastly, if you want people to actually use your tool effectively you should create an entire map and then document steps on how to create the map you made. It's really hard for me to grasp how to use Oreo Triggers by just reading the post on it.
This post was edited 1 time, last edit by CecilSunkure: Jun 27 2012, 12:46 am.

(user posted image)
Top

Post #29     yoonkwun Jun 27 2012, 1:03 am

[Avatar]
offlinecontact
Rank: Regular
Quote from CecilSunkure
I'm mostly interested in how you place triggers into the map file. Is there documentation somewhere on the file format of starcraft scenario files? Pretty interesting as I just developed something similar: LINK.

StarCraft maps are nothing more than MPQ archives with a staredit\scenario.chk (plus optional .wav's). I used SFmpqapi for the Mint backend.

Here's the (single) source for mint.cpp: http://pastebin.com/hKsNcc6C
It uses SFmpqapi and expat.

Edit: Alternative scenario.chk documentation: http://www.staredit.net/?p=oldwiki&s=17
Heinermann had his own documentation somewhere.
Edit2: Er, I was thinking of this, which really isn't primary documentation but oh well: http://code.google.com/p/vgce/wiki/chkCompression
This post was edited 1 time, last edit by yoonkwun: Jun 27 2012, 2:52 am.

Top

Post #30     Kaias Jun 27 2012, 3:31 am

[Avatar]
offlinecontact
Rank: Veteran
Quote from CecilSunkure
Also, is the source included in the download or anywhere else?

Lastly, if you want people to actually use your tool effectively you should create an entire map and then document steps on how to create the map you made. It's really hard for me to grasp how to use Oreo Triggers by just reading the post on it.
The source is completely exposed in the download.

I considered making that, but the time it takes to make a tutorial like that is considerable. I'll see what I can do.

Top

Post #31     Jack[RCDF Jun 27 2012, 6:14 am

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
Oreo Triggers is really easy to use, IMO it doesn't really need more tutorial than what you have, although perhaps add a section on making loops for generating large amounts of incremental triggers.

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #32     Oh_Man Jun 30 2012, 12:56 pm

[Avatar]
Creation is the province of man.
offlinecontact
Rank: Regular
I don't know if this is already done or not, and it could probably be stand alone and not part of Oreo.

But someone should make some sort of notepad addon that allows you to change a single variable into a set of unique variables.


OK so say I have my trigger for healing at 1%. I then copy that trigger 100 times. Now I have to go through each copy and change it to 2, 3, 4 all the way up to 100. Pretty menial work. It would be cool if you could go like, Replace 1 with 12345...etc.

Top

Post #33     Biophysicist Jun 30 2012, 2:25 pm

[Avatar]
:(){ :|:& };:
offlinecontact
Rank: Regular
That's built into PHP. Look up for loops. http://php.net/manual/en/control-structures.for.php

Example:

Code

$P1 = new Player("Player 1");
$timer = new Deathcounter();
for($i = 0; $i < 121; $i++) {
    $P1->_if( $timer->exactly($i) )->then(
        Display("Timer is $i."),
    '');
}
$P1->_if( $timer->exactly(0) )->then(
    $timer->setTo(120),
'');
$P1->always(
    $timer->subtract(1),
'');

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
Top

Post #34     CecilSunkure Jun 30 2012, 5:00 pm

[Avatar]
offlinecontact
Rank: Veteran
Quote from Oh_Man
I don't know if this is already done or not, and it could probably be stand alone and not part of Oreo.

But someone should make some sort of notepad addon that allows you to change a single variable into a set of unique variables.


OK so say I have my trigger for healing at 1%. I then copy that trigger 100 times. Now I have to go through each copy and change it to 2, 3, 4 all the way up to 100. Pretty menial work. It would be cool if you could go like, Replace 1 with 12345...etc.
Somebody already made a tool to do this. It's in the downloads section of SEN. I can't remember who. It was someone like Clokr or MindArchon.

(user posted image)
Top

Post #35     Kaias Jun 30 2012, 5:33 pm

[Avatar]
offlinecontact
Rank: Veteran
Quote from Biophysicist
That's built into PHP. Look up for loops. http://php.net/manual/en/control-structures.for.php

Example:

Code

$P1 = new Player("Player 1");
$timer = new Deathcounter();
for($i = 0; $i < 121; $i++) {
    $P1->_if( $timer->exactly($i) )->then(
        Display("Timer is $i."),
    '');
}
$P1->_if( $timer->exactly(0) )->then(
    $timer->setTo(120),
'');
$P1->always(
    $timer->subtract(1),
'');
Biophysicist is right. Part of the reason I made this as a sort of API rather than a custom language is so that you benefit from the data handling and functions of php. You can make your own functions and classes with Oreos if you wanted.

New Update: 0.9.1
  • You can now optionally specify an amount in ->giveTo(), ->kill() and ->remove() methods of UnitGroup (defaults to 'All')
  • Mint provides an error message if your input or output maps fail
  • Fixed a bug when using Mint with the Order action
  • Added a MintMapRevealers function, which places map revealers spaced out across the map for the specified players
  • Fixed a bug where Oreo triggers wasn't automatically removing extraneous triggers
  • Added a repeat() function which takes the actions you pass to it and duplicates it the number of times you specify. Example of usage:
    (user posted image)

Download Link:
http://www.mediafire.com/?8ku895s94z745t2

Top

Post #36     Kaias Jul 7 2012, 7:30 pm

[Avatar]
offlinecontact
Rank: Veteran
New Update 0.9.2
  • Fixed a bug when using multi-trigger conditions within if else triggers
  • Added a ForemostPlayer() condition which returns 'true' for the first player to run triggers. This is primarily if you won't want to require a Player1 to be in the game but have systems that need to happen at the start of the trigger list.
  • Added PlayerSwitch class
    (user posted image)
  • Added an Event class which gives you access to the justHappened(), isHappening(), isStopped(), justStopped() and happensFor() functions for the conditions you declare for it. Three ways to use it:
    Specifying a player object and then a condition. The conditions you gain access to are for "Current Player".
    (user posted image)

    Specifying the condition that needs to be true for each player in an array. The conditions you gain access to are for "Current Player".
    (user posted image)

    Specifying only a condition. The supporting triggers it creates are run at the beginning of the trigger list for the foremost player. This means the conditions you gain access to aren't player specific since no players were specified.
    (user posted image)

  • Fixed a bug where escape codes weren't working in displayed text with Mint (e.g. \r\n)
  • Playing Wavs in Mint now works (wavs must be minted in your code however). Wavs are minted with the MintWav(filepath, name) function. The string you specify for the name is the string you'll provide to PlayWav in order to play the Wav.
    (user posted image)
  • Fixed a bug for division functions (divideBy, roundedDivideBy, quotientOf, roundedQuotientOf, QuotientAndMod, modulus, modulusOf)
  • Oreos now automatically adds hyper triggers for player 8. You can specify which player to do it for instead using a Player object and ->hypertriggers(). Example:
    (user posted image)
    It will add the hyper triggers at the end of the trigger list regardless of where you call the function.

Download Link:
http://www.mediafire.com/?5f52tuh0okxau39

By the way, you can do a complement operation on your conditions by passing them to not(). Example:
(user posted image)
This feature has been in Oreo since the beginning, I just hadn't documented it (like a lot of the features).

Top

Post #37     Jack[RCDF Jul 12 2012, 1:24 pm

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
Quote
( ! ) Parse error: syntax error, unexpected $end in C:\wamp\www\Oreo\initialize.php on line 86
Happens with all the local servers I've tried. PHP version 5.3.13, and 5.4. Tried a couple versions of oreo, the latest one in this thread and the one you sent me on bnet.

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #38     Kaias Jul 13 2012, 12:43 am

[Avatar]
offlinecontact
Rank: Veteran
Update: 0.9.3
  • Fixed a bug in autmatically creating hypers when using Mint
  • Fixed a bug with prepended triggers when not using Mint
  • CenterView now works for Mint
  • Men, AnyUnit, Factories, and Buildings now work for units in Mint
  • Added ModifyHangar(($player, $unit, $n, $location, $amounttoadd)
  • Added Added Leaderboard functions: LeaderBoardComputers(), LeaderBoardControl(), LeaderBoardControlAtLocation(), LeaderBoardKills(), LeaderBoardGreed(), LeaderBoardResources(), LeaderBoardGoalControl(), LeaderBoardGoalControlAtLocation(), LeaderBoardGoalKills(), LeaderBoardGoalResources()
  • Added Deathcounter leaderboard() function, which displays the deathcounter's data on the leaderboard
  • Fixed bug where not() didn't work with complex (multi-trigger) conditions
  • Added SuppressOutput() (stops Oreo from outputting triggers to the webpage when using Mint, which can reduce compile time significantly)

Download Link:
http://www.mediafire.com/?s9ff64op5c9dbjl

Top

Post #39     Jack[RCDF Jul 13 2012, 2:57 pm

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
How do I use properties with CreateUnitWithProperties?

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #40     samsizzle! Jul 14 2012, 8:52 am

[Avatar]
offlinecontact
Rank: Regular
(user posted image)

(signature image)
Top
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)


[11:05 pm]
jjf28 -- haha
[11:04 pm]
RIVE -- Fucking lost me.
[11:04 pm]
RIVE -- "I'm proud to introduce ... Electronic Arts."
[11:04 pm]
RIVE -- "... the real magic happens when you put that power in the hands of the world's greatest creators."
[09:21 pm]
Azrael -- See ya :kame:
[09:21 pm]
Azrael -- I don't have any more time to play your little purposefully obtuse game ;o
[09:21 pm]
O)FaRTy1billion -- Bye now
Please log in to shout.