[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.
start_town()
transports_off()
farms_notiming()
# 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 ===========================
--g_MainBuildingStart--
farms_timing()
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)
wait(2000)
debug(e_blah, Observers Begin!)
--e_blah--
multirun(getObservers1) # Thread #
wait(2000)
debug(s_blah, end of main loop!)
--s_blah--
goto(finalLoop)
#============================= END START =======================
#=========== UNIT MULTIPLES ==========================
--getObservers1--
call(getObservers) #Method to setup buildings ready for Observer
train(1, Protoss Observer)
stop()
#================== Final Loops ==============================
--finalLoop--
debug(s_MainStep1, I'm in a loop)
--s_MainStep1--
multirun(getObservers1)
wait(3000)
goto(finalLoop)
#======================== LIBRARY =======================
#Units
#===============================
--getProbes--
debug(s_probe, getProbes Method called!)
--s_probe--
player_need(1, Protoss Nexus)
wait_build(1, Protoss Nexus)
debug(e_probe, Finished with getProbes)
--e_probe--
return()
--getZealots--
debug(s_zealot, Entered getZealots)
--s_zealot--
call(getProbes)
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)
--e_zealot--
return()
--getDragoons--
debug(s_Dragoons, Entered getDragoons)
--s_Dragoons--
call(getZealots)
player_need(1, Protoss Cybernetics Core)
wait_build(1, Protoss Cybernetics Core)
debug(e_Dragoons, Finish Dragoons)
--e_Dragoons--
return()
--getShuttles--
debug(s_Shuttles, Entered getShuttles)
--s_Shuttles--
call(getDragoons)
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)
--e_Shuttles--
return()
--getObservers--
debug(s_Observers, Entered getObservers)
--s_Observers--
call(getShuttles)
player_need(1, Protoss Observatory)
wait_build(1, Protoss Observatory)
debug(e_Observers, Finish getObservers)
--e_Observers--
return()
[/quote]
You CANNOT use wait commands in a call, and you CANNOT use more than one call.
SCAIEdit III list of commands
-
- Posts: 362
- Joined: Thu Apr 26, 2007 12:42 am
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.
Examples:
I had waits inside of the calls such as this:
Examples:
Code: Select all
call(trainMarines)
...
--trainMarines--
train(1, Terran Marine)
return()
Code: Select all
goto(trainMarines)
--trainMarinesDone--
...
--trainMarines--
train(1, Terran Marine)
goto(trainMarinesDone)
I had waits inside of the calls such as this:
Code: Select all
call(buildGate1)
call(buildGate2)
etc...
--buildGate1--
--_testGateway1--
resources_jump(150, 0, _buildGateway1)
wait(50)
goto(_testGateway1)
--_buildGateway1--
build(1, Protoss Gateway, 80)
wait_buildstart(1, Protoss Gateway)
wait(100)
return()
-
- Posts: 362
- Joined: Thu Apr 26, 2007 12:42 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.
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
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.
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.
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
-
- Posts: 362
- Joined: Thu Apr 26, 2007 12:42 am
Re: SCAIEdit III list of commands
The continuation of this topic will be here: http://broodwarai.com/forums/viewtopic.php?f=5&t=1043
Who is online
Users browsing this forum: No registered users and 1 guest