Make maps with PHP SCX Editor

 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Edited 12 April 2016 - 7:47 pm by AzZzRu
PHP SCX Editor

PHP SCX Editor is a powerful tool / framework to edit aoc scenarios with PHP programming language. If you handle it you could make anything very easily. It's A LOT more powerful than aokts, you have the ability to build your own editor fonctionnalities very easily and organize your scenario how you want. That is very accessible to people who like programming and know it already a little bit. For others, you can still try it, programming is an intuitive skill and can be innate ! You could love it as you could hate it, it depends of people. Aoc triggers is a crap programming language which is boring and quite repetitive, if you can like that, you will love to practice a real programming language like PHP that allows you to build anything faster and smarter.

Don't be scared about complexity, the functions that are available are very intuitive and easy to use. It's much more smooth than an UI, but it takes more time to handle that, of course. When you'll handle the script you will have more time to think to your scenario instead of writing triggers, you could create fast almost whatever you think, and modify result very easily. You can message me, if you are motivated I will help you by Skype.

Features:
- Design scenarios how you want with PHP programmation. You can build them in smoother and faster ways, no more boring repetive tasks.
- Use ready to use simple and intuitive functions to read / write scenarios properties and write triggers.
- Use conditions, loops and any classic programming feature to generate triggers or anything in a scenario.
- Create complex custom conditions / effects / triggers sequence / macros.
- Assign any fields to values calculated by algorithm and variables.
- Copy paste triggers or any reusable code in new scenarios.
- Have a great overview of your triggers and your whole scenario in a single page.
- Build your own aoc editor framework to fill your needs.
- Modify your scenario by changing variables, no more need to edit triggers one per one.
- Change triggers order as you want, just cut paste code.
- Scenarios that would need 100 hours to make could need only 10 hours now !
- And more...!

Potential example: Making all CBA spawns with tasks for 8 players would need 12 lines of code:
Code:
$spawns = array(array(22,48),array(22,52),array(22,55),array(22,59)); $meetPoint = AreaPlayers(array(29,53)); Trig("Research Civ Techs"); foreach(range(1,8) as $p)foreach(LIB::$CivTechs as $tech)Efft_Research($p,$tech); foreach(range(1,8) as $p)foreach(LIB::$CivTechs as $civ => $tech){ Trig("Spawn Player $p - Civ $civ",1,1); Cond_Researched($p,$tech); Cond_Timer(4); Cond_NotOwnY($p,Y_MILITARY,40); foreach($spawns as $L)Efft_Create($p,LIB::$CivEliteUnit[$civ],AreaPlayer($p,$L));} Trig("Tasks",1,1); foreach(range(1,8) as $p)foreach($spawns as $L)Efft_TaskO($p,AreaPlayer($p,$L),$meetPoint[$p]);

More informations / Tutorial here:
[You must login to view link]

Download link:
[You must login to view link]
Link | Reply | Quote
 SeriousMan


Group: Standard Membership
Join Date: 14 June 2013
Posts:728
Posted 11 November 2014 - 9:08 pm
Boy, I wish I had this back when I had the desire to make maps.
Link | Reply | Quote
 23RaidingParty


Group: Standard Membership
Join Date: 27 May 2008
Posts:2265
Posted 11 November 2014 - 10:37 pm
cool

but I thought SCX files were compressed, how did you manage to know its compression algorithm and decompress the files to allow them to be scripted in text?
Link | Reply | Quote
 +Gallas


Group: System Operator
Join Date: 25 May 2011
Posts:2419
Edited 12 November 2014 - 12:11 am by +Gallas
Thanks for posting this (pinned and wrote tutorial here too in "Voobly style"). Will suggest for new editors this way too.
Link | Reply | Quote
 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Edited 12 November 2014 - 12:43 pm by AzZzRu
Thanks gallas for the nice edit.

Suicide i'm not the expert to explain you that, the decompression function has been written by AOHH. He mainly used the function unpack which read progressively a .scx from its first bit to its last bit. DiGiT made a documentation which tell you how is compressed the scx format.

Then it store data read in a variable, after editing the variable the script do exactly the same process than decompression but in the other direction with pack function, from your variable.
Link | Reply | Quote
 23RaidingParty


Group: Standard Membership
Join Date: 27 May 2008
Posts:2265
Posted 12 November 2014 - 10:37 pm
AzZzRu wrote:
Thanks gallas for the nice edit.

Suicide i'm not the expert to explain you that, the decompression function has been written by AOHH. He mainly used the function unpack which read progressively a .scx from its first bit to its last bit. DiGiT made a documentation which tell you how is compressed the scx format.

Then it store data read in a variable, after editing the variable the script do exactly the same process than decompression but in the other direction with pack function, from your variable.

do you have link for DiGiT documentation?
i search but not find
Link | Reply | Quote
 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Edited 12 November 2014 - 11:07 pm by AzZzRu
Just download aokts it is provided with it, the file is called scx_format.txt.
Link | Reply | Quote
 23RaidingParty


Group: Standard Membership
Join Date: 27 May 2008
Posts:2265
Edited 12 November 2014 - 11:08 pm by 23RaidingParty
AzZzRu wrote:
Just download aokts it is provided with it, the file is called scx_format.txt.

ooh i remember now
thanks homme
Link | Reply | Quote
 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Posted 7 May 2015 - 9:14 pm
Updated, easier to use. Library.php added to the script.
Link | Reply | Quote
 HidingBeyond


Group: Standard Membership
Join Date: 31 July 2011
Posts:2688
Edited 21 August 2015 - 4:45 pm by HidingBeyond
I finally worked up the enthusiasm to try this out.

I'm making slow progress right now but I have to say making a hundred triggers in a few pastes really feels good!



Ah, I have hit a wall.

I can't get the activate trigger to work for me :( It just turns out red when I load the map.
Code:
Trig('act p1 t1',1,0); Efft_Act('p1 is t1');
Code:
Trig('p1 is t1',0,0); $player = 1; $x = 29; for($y = 71; $y < 81; $y++) Efft_Create($player,U_WALL_STONE,array($x,$y));
Link | Reply | Quote
 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Edited 21 August 2015 - 6:09 pm by AzZzRu
I tried your code with PSE v2.4.13 / PHP v5.6.9-nts-Win32-VC11 and it's working fine for me. You can send me your whole project and tell me what PHP version you are using I'll try with it.

Also I guess you know but you have to run Compiler.php two times to make activate / deactivate effects working.

Do you see this in the output window, even after two compilations: "===>>> p1 is t1" ?
Link | Reply | Quote
 HidingBeyond


Group: Standard Membership
Join Date: 31 July 2011
Posts:2688
Posted 21 August 2015 - 6:17 pm
AzZzRu wrote:
Also I guess you know but you have to run Compiler.php two times to make activate / deactivate effects working.

Do you see this in the output window, even after two compilations: "===>>> p1 is t1" ?

I did these yes.

I'm still learning so I'll contact you when I really need to get it to work.
Link | Reply | Quote
 HidingBeyond


Group: Standard Membership
Join Date: 31 July 2011
Posts:2688
Posted 21 August 2015 - 6:29 pm
Is there any place to copy stuff like team detection triggers?
Link | Reply | Quote
 AzZzRu


Group: Standard Membership
Join Date: 20 January 2011
Posts:236
Edited 21 August 2015 - 7:04 pm by AzZzRu
Mmmmm, it's maybe because your PHP stores files in different ways than mine for reasons that I don't know.

It doesn't find the file "Triggers.inc" where is stored triggers ids from last compilation, you can try to specify absolute path to it, it should fix this.

In compiler.php change these lines:
Code:
Line 35: if(file_exists('Triggers.inc')) include 'Triggers.inc'; # Get triggers IDs from last compilation Line 45: file_put_contents('Triggers.inc',$Conts);

To this:
Code:
Line 35: if(file_exists($TempPath.'\Triggers.inc')) include $TempPath.'\Triggers.inc'; # Get triggers IDs from last compilation Line 45: file_put_contents($TempPath.'\Triggers.inc',$Conts);

And at top of Compiler.php add this variable, and specify path to your custom temp folder, for example:
Code:
$TempPath = 'C:\Temp';

The folder must exists, else it won't work. After first compilation a file called "Triggers.inc" should be created in the folder you specified.
Quote:
Is there any place to copy stuff like team detection triggers?
No, currently all stuff is available in Library.php, more should come with updates, I add stuff that I made or people sent me. Maybe if more people get used to it I could make something like a wiki page where people can share reusable code they made.
Link | Reply | Quote
 HidingBeyond


Group: Standard Membership
Join Date: 31 July 2011
Posts:2688
Posted 21 August 2015 - 7:43 pm
http://aoc.voobly.com/display/aoc/AoC+Knowledge+Base

Maybe you could get a section here.


Link | Reply | Quote
[1]2
Displaying 1 - 15 out of 16 posts
Forum Jump:
1 User(s) are reading this topic (in the past 30 minutes)
0 members, 1 guests

Most active threads in past week: