Staredit Network > Forums > SC1 Mapping Tools > Topic: Oreo Triggers
Oreo Triggers
Jun 2 2012, 9:22 am
By: Kaias
Pages: < 1 2 3 45 >
 

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

🤙🏾

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.



🤙🏾

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

>be faceless void >mfw I have no face

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.

"In short, their absurdities are so extreme that it is painful even to quote them."

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



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




None.

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



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:

    The statement would be analogous to

  • 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:

    then if you wrap oreo actions in analyze(), it will tell you how many triggers the action(s) is/are generating. Example:


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

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



None.

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

Find Me On Discord (Brood War UMS Community & Staredit Network)

This should be front-paged. Admins - make this a priority.




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

>be faceless void >mfw I have no face

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.

"In short, their absurdities are so extreme that it is painful even to quote them."

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



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:

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:


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.

Post has been edited 1 time(s), last time on Jun 27 2012, 3:29 am by Kaias.



None.

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



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.

Post has been edited 1 time(s), last time on Jun 27 2012, 12:46 am by CecilSunkure.



None.

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



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

Post has been edited 1 time(s), last time on Jun 27 2012, 2:52 am by yoonkwun.



None.

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



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.



None.

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

>be faceless void >mfw I have no face

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.

"In short, their absurdities are so extreme that it is painful even to quote them."

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

Find Me On Discord (Brood War UMS Community & Staredit Network)

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.




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



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),
'');




None.

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



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.



None.

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



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:


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



None.

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



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

  • 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".


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


    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.


  • 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.

  • 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:

    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:

This feature has been in Oreo since the beginning, I just hadn't documented it (like a lot of the features).



None.

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

>be faceless void >mfw I have no face

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.

"In short, their absurdities are so extreme that it is painful even to quote them."

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



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



None.

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

>be faceless void >mfw I have no face

How do I use properties with CreateUnitWithProperties?



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

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







None.

Options
Pages: < 1 2 3 45 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:07 am]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider <3
even though I clearly put no effort into those arrows? :P
[05:06 am]
NudeRaider -- http://i.snipboard.io/k3C9O2.jpg ... because all the main characters suffocated during this scene
[03:41 am]
Ultraviolet -- NudeRaider
NudeRaider shouted: Ultraviolet http://i.snipboard.io/UcMhWZ.jpg
<3
[02:13 am]
NudeRaider -- actually without special measures "only" 2GB
[01:24 am]
NudeRaider -- The changes are all "under the hood" main reason for 64 bit is access to more than ~3.5GB RAM. Probably not relevant to Starcraft though.
[09:28 pm]
Zoan -- Does that change much?
[07:31 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: how do? Just open the 32bit exe from program files? Or is there something I need to change in the launcher app?
http://i.snipboard.io/UcMhWZ.jpg
[05:49 pm]
Ultraviolet -- how do? Just open the 32bit exe from program files? Or is there something I need to change in the launcher app?
[05:47 pm]
Ultraviolet -- will do
[12:20 pm]
Suicidal Insanity -- try 32bit?
Please log in to shout.


Members Online: Roy, jun3hong, GGmano, evuxywy