SCAIEdit III list of commands

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Postby Heinermann » Sun Jan 01, 2012 12:35 pm

[quote name='dmwright' date='03 October 2010 - 02:50 PM' timestamp='1286117448' post='9757']
I'm having a bit of trouble with the Call(block) command. I have been trying to use the call command within a multirun command. BUt doesn't like too many nested Calls... Am I missing anything?

The result I got from this script, is 3 Gateways all pumping out Zealots.. And no Cybernetics Core...
Script :

# Initialize town, turn automatic pylons off, transports off.

# Declarations
define_max(80, Protoss Probe)
define_max(50, Protoss Zealot)
define_max(50, Protoss Dragoon)
define_max(6, Protoss High Templar)
define_max(20, Protoss Dark Templar)
define_max(6, Protoss Archon)
define_max(2, Protoss Dark Archon)
define_max(1, Protoss Shuttle)
define_max(3, Protoss Reaver)
define_max(6, Protoss Observer)
define_max(30, Protoss Scout)
define_max(15, Protoss Carrier)
define_max(4, Protoss Arbiter)
define_max(4, Protoss Corsair)
debug(g_MainBuildingStart, Hello world I'm a new born Protoss AI)

#========================= START CODE ===========================


build(8, Protoss Probe, 150)
wait_buildstart(8, Protoss Probe)
build(1, Protoss Assimilator, 80)
player_need(4, Protoss Pylon)
wait_build(4, Protoss Pylon)
build(3, Protoss Gateway,150)

debug(e_blah, Observers Begin!)
multirun(getObservers1) # Thread #


debug(s_blah, end of main loop!)


#============================= END START =======================

#=========== UNIT MULTIPLES ==========================
call(getObservers) #Method to setup buildings ready for Observer
train(1, Protoss Observer)

#================== Final Loops ==============================
debug(s_MainStep1, I'm in a loop)

#======================== LIBRARY =======================

debug(s_probe, getProbes Method called!)
player_need(1, Protoss Nexus)
wait_build(1, Protoss Nexus)
debug(e_probe, Finished with getProbes)

debug(s_zealot, Entered getZealots)
player_need(1, Protoss Pylon)
wait_build(1, Protoss Pylon)
player_need(1, Protoss Gateway)
wait_build(1, Protoss Gateway)
debug(e_zealot, Finish getZealots)

debug(s_Dragoons, Entered getDragoons)
player_need(1, Protoss Cybernetics Core)
wait_build(1, Protoss Cybernetics Core)
debug(e_Dragoons, Finish Dragoons)

debug(s_Shuttles, Entered getShuttles)
player_need(3, Protoss Pylon)
wait_build(3, Protoss Pylon)
player_need(1, Protoss Robotics Facility)
wait_build(1, Protoss Robotics Facility)
debug(e_Shuttles, Finish Shuttles)

debug(s_Observers, Entered getObservers)
player_need(1, Protoss Observatory)
wait_build(1, Protoss Observatory)
debug(e_Observers, Finish getObservers)
You CANNOT use wait commands in a call, and you CANNOT use more than one call.
User avatar
Posts: 257
Joined: Sat Jun 13, 2009 12:56 pm

Postby Myk » Sun Jan 01, 2012 10:53 pm

That doesn't seem to follow my experience, but that might just be foggy memory. I thought call/return functioned more or less like using goto.


Code: Select all

train(1, Terran Marine)

Code: Select all

train(1, Terran Marine)

I had waits inside of the calls such as this:

Code: Select all


   resources_jump(150, 0, _buildGateway1)
   build(1, Protoss Gateway, 80)
   wait_buildstart(1, Protoss Gateway)
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Postby Heinermann » Mon Jan 02, 2012 5:49 am

Well you can, but don't expect your script to work correctly when there is more than one computer running it.
A call stores the return location in a static global variable rather than a per-ai variable, which means any code that causes a script to halt could potentially bug. If the other script makes a call, then the return offset will be overwritten.
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Postby Heinermann » Sun Feb 12, 2012 2:37 am

eval_harass compares unit strengths.

My somewhat correct interpretation:
1. Computes unit strength of the attack group
2. Computes unit strength of enemies within 1024 pixels of the attack group's region(?)
3. If both the AI's ground/air strengths are below both the enemy's ground/air strengths, then the script jumps to the offset, otherwise it will ignore this opcode.

For region_size, the byte is for 32*x number of tiles. You should be able to use this to check the size of the map. It will jump if the actual region size is smaller than the given size.
User avatar
Posts: 256
Joined: Tue Sep 07, 2010 9:41 pm

Postby Taranok » Thu Feb 16, 2012 9:24 am

default_min (byte) - defines how much standing army (from defenseuse commands) will be placed at expansions. The greater the value, more units will be sent. If (byte) = 0, no army at expansions, will send units only if expansion is under attack.

Does this mean you have to have defenseuse commands in place and then use default min? Or can you use it without defenseuse?
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Postby Heinermann » Mon Dec 17, 2012 3:48 am

default_min is some kind of scaler value and may have to do with unit strength.
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Re: SCAIEdit III list of commands

Postby Heinermann » Sun Dec 30, 2012 8:14 am

The continuation of this topic will be here:

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 3 guests