Staredit Network

Staredit Network -> Concepts -> Trigger processes
Report, edit, etc...Posted by BSTRhino on 2005-01-13 at 22:44:48
Over the past week I've been making a map, but just yesterday I corrupted it with WinMPQ. The map was highly trigger-intensive, and going back to the last backup would waste hours of my time rebuilding the thing. But there is a good side to this, I have been inspired to create an abstract way of creating processes using StarCraft triggers.


It's quite simple, it runs on the system of death counters like we use today. The main idea is though, you instead write your triggers in a special programming language, like this:

CODE
if(bring(location['someLocation'],unit['Overlord']) == 0) {
  createUnit(1, unit['Overlord']);
  jump FillOverlord;
}
jump DisplayMenu;

FillOverlord:
  createUnit(8, unit['Zergling']);
  waitFor(bring(location['someLocation'],unit['Zergling']) == 8);
  runAIScriptAtLocation(location['someLocation'],aiScript['Enter Transport']);

DisplayMenu:
  if(menuID == 101) {
     displayTextMessage('Menu 1...');
  }
  elseif(menuID == 102) {
     displayTextMessage('Menu 2...');
  }

...


The idea is, you would write the code for one process (death counter) in one file. Then the system would recognise your code and turn it into triggers. I have already worked out a system for turning this code into an intermediate stage which then allows triggers to be generated directly, and if I knew how to type it up (right now it's in a diagram form) I would.

I really think that this is possible, the algorithms which I have drawn out seems to be quite solid, and at the moment there aren't any complications I can see. What do you guys think?

I'm going to be programming this in either a combination of C#.NET and JScript.NET or I'll make it in Java 5.0. What I just wanted to know is if you guys could see any possible complications before I start programming.
Report, edit, etc...Posted by Yoshi da Sniper on 2005-01-14 at 00:07:47
It sounds awesome to me, if you could get some nice programming conventions in there smile.gif
Report, edit, etc...Posted by DT_Battlekruser on 2005-01-14 at 00:23:53
QUOTE(BSTRhino @ Jan 13 2005, 07:44 PM)
Over the past week I've been making a map, but just yesterday I corrupted it with WinMPQ. The map was highly trigger-intensive, and going back to the last backup would waste hours of my time rebuilding the thing. But there is a good side to this, I have been inspired to create an abstract way of creating processes using StarCraft triggers.
It's quite simple, it runs on the system of death counters like we use today. The main idea is though, you instead write your triggers in a special programming language, like this:

CODE
if(bring(location['someLocation'],unit['Overlord']) == 0) {
  createUnit(1, unit['Overlord']);
  jump FillOverlord;
}
jump DisplayMenu;

FillOverlord:
  createUnit(8, unit['Zergling']);
  waitFor(bring(location['someLocation'],unit['Zergling']) == 8);
  runAIScriptAtLocation(location['someLocation'],aiScript['Enter Transport']);

DisplayMenu:
  if(menuID == 101) {
     displayTextMessage('Menu 1...');
  }
  elseif(menuID == 102) {
     displayTextMessage('Menu 2...');
  }

...


The idea is, you would write the code for one process (death counter) in one file. Then the system would recognise your code and turn it into triggers. I have already worked out a system for turning this code into an intermediate stage which then allows triggers to be generated directly, and if I knew how to type it up (right now it's in a diagram form) I would.

I really think that this is possible, the algorithms which I have drawn out seems to be quite solid, and at the moment there aren't any complications I can see. What do you guys think?

I'm going to be programming this in either a combination of C#.NET and JScript.NET or I'll make it in Java 5.0. What I just wanted to know is if you guys could see any possible complications before I start programming.
[right][snapback]124940[/snapback][/right]



HEY that was my idea. Except i can't write a CHK. Have fun. Meanwhile, you should add things like variables and other super-starcaft concepts. Spend a moment think of how things can be achieved using complicated series of triggers. For example, I had an idea for string variables. Use death countes for a specific unit of a player (each counter ranging from 0 to about 50^3, representing combinations of three characters) and then using a long series of triggers to analog "Displaytext("Lives" + lives + "!", 4);

I'm not sure if there is a simple way of scripting the trigger conversions.

Anyhow, spend some time brainstorming new actions, that are in fact a big bunch of triggers.
Report, edit, etc...Posted by BeeR_KeG on 2005-01-14 at 15:02:15
I don't get this. Can you explain this in user friendly language since I don't know anything about programing.
Report, edit, etc...Posted by BSTRhino on 2005-01-14 at 17:56:19
Heh, I don't really know how to explain it in plain English.

Whenever I make triggers, I always make them with a death counter to track the current stage of the map. And I always make a plan of what happens at each stage before I start creating triggers. For example, here was my plan just one of the death counters for my last map:

QUOTE
Conquestor Disruption Web - Menu Reload Status
0: Null. Destroy overlord if it exists.

1000: Begin menu setup, assign 201 if menu not set.
1001: If no overlord, create overlord and jump to 1200, otherwise jump to 1500.

1200: When M.LoadUnits unlocked, lock, center M.LoadUnitsOriginalPosition on Overlord and move overlord to M.LoadUnits.
1201: Jump to 1210

1210: Initialise unit load
1211: Create all units
1212: Load all units
1213: Return overlord to M.LoadUnitsOriginalPosition, Unlock M.LoadUnits, Jump to 1500

1500: Do nothing
1501: Display menu text
1502: Jump to 2000

2000: When selection detector location unlocked, lock and center.
2001: If no selection, release lock, return to 2000
2002: Clear screen, jump to 2100

2100: Initialise load selected ID.
2101: Load Selected ID
2102: When M.LoadUnits unlocked, lock, center M.LoadUnitsOriginalPosition on Overlord and move overlord to M.LoadUnits
2103: Move units from selector detector location to M.LoadUnits, release selector detection location lock, load units in M.LoadUnits
2104: When M.LoadUnits is clear, return overlord to M.LoadUnitsOriginalPosition, Unlock M.LoadUnits.
2105: Jump to 2200

2200: If selected ID within the range Option 1 - Option 6 and unit construction in progress, display error and return to 1000.
2201: Process selected ID - may jump to 1500 to display new/same menu, otherwise will set selected unit ID.
2202: If no unit selected, display error message and return to 1501, else jump to 2300

2300: Initialise resource cost check
2301: Check selected unit resources. On error, display error message and return to 1501.
2302: Jump to 3000

3000: When C.ConstructionStart unlocked, lock, center on Overlord.
3001: Create Uraj crystals for each decrement of build time (current player scantid).
3002: Create Psi Emitter for unit in progress.
3003: Unlock C.ConstructionStart, jump to 1501


I create at least one trigger for each of the stages above, with the condition "Current Player has suffered exactly 2302 deaths of Disruption Web" where the 2302 is substituted with the current stage. At the end of every stage, there is a "Add 1 deaths of Disruption Web for Current Player" so that it advances to the next stage, and then the next stage triggers itself, depending on what conditions it has. I do all sorts of complicated bits there, like some stages wait on a condition before advancing, or some stages may do a series of 24 different things depending on the conditions, and some jump to other stages.

Then I take multiple death counters, each of them with their own plan. I call them "trigger processes" or "trigger threads" because like in a computer, I can make two death counters with their own plans run alongside each other, and wait for each other, yet they are two distinct processes.

What I found was, those plans I was writing up there, they're basically just programming language, and I'm a human compiler for it. So I thought, what if I found a formal way to express those plans, and have the computer do the compilation for me.

If you've used death counters for stages, even if you haven't used all the jumps, waits and conditionals like I can't live without, you'll probably be able to relate to this. If you haven't, then you probably won't understand a thing I just said. And if you're one of those people, you really should train yourself in the art of using death counts as stages, they're the only way I know of to organise and coordinate a super-intensely triggerised map and I use them to death (lol).





Anyway, I have just figured out an algorithm (a processing plan to achieve something) that will take in the wonderous code and turn it into that intermediate structure I worked out yesterday. So that's three out of four abstraction layers worked out, the only layer I haven't looked at yet is turning my triggering objects and string objects into the CHK format. That'll be easy enough though, I have done CHK programming before so I know that this will be the easiest layer.




DT, I won't be extending actions in this release. I want to get a stable release out as soon as possible. Another release is likely to include macros of some sort that will allow you to inline-insert trigger commands from another file whenever you write a certain thing.
Report, edit, etc...Posted by MindArchon on 2005-01-14 at 18:17:37
The elseif and else will be awesome for starcraft.

Anyway, is there anyway to make global vairables, such as

DisplayText(P1Minerals);

That would be so pro.

What's actually possible with this?

Can you do loops?
Next Page (1)