Announcement: Remember: you are giving away your fantastic ideas for free, and somebody else might even make money from them (or appear to). That's just how the world works! If you're worried about it, maybe you shouldn't post your ideas here.


Caravel Forum : DROD Boards : Feature Requests : Use command "Wait for no build markers at" as a condition (Cannot be done currently)
New Topic New Poll Post Reply
Poster Message
Chaco
Level: Smitemaster
Rank Points: 3773
Registered: 10-06-2005
IP: Logged

File: Build Marker Conditional.hold (1.1 KB)
Downloaded 44 times.
License: Public Domain
icon Use command "Wait for no build markers at" as a condition (0)  
Currently, the script
If...
 Wait for no build markers at (x,y)-(x2,y2)
 Speech Beethro "No build markers at area"
Else
 Speech Beethro "Build markers at area"
If End

instead of executing the first branch conditionally based upon whether or not there are build markers in the rectangle (x,y)-(x2,y2) waits for there to be no build markers at the location and always executes the first branch.

In other words, when used as a condition, the test always evaluates to true and the script then waits for that condition to evaluate to true before continuing with the first branch.

Somehow I think this is merely because Wait for no build markers at has not been added to some List of Valid Conditional Commands.

____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text


[Last edited by Chaco at 11-13-2007 11:26 PM]
11-13-2007 at 11:24 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1309
Registered: 11-24-2005
IP: Logged
icon Re: Use command "Wait for no build markers at" as a condition (+1)  
And this is why macros are evil.

Also, yay for lambdas in C++0x.

Because the STOP_COMMAND in line 1607 of DRODLib/Character.cpp is in a braceless for loop, the code parses wrong. Simply wrap it in braces and things will work.

Since this has most likely had some changing in version 3.5, I will also add that it is the only STOP_COMMAND in the case for CCharacterCommand::CC_WaitForNoBuilding.
11-14-2007 at 04:46 AM
View Profile Show all user's posts Quote Reply
schep
Level: Smitemaster
Avatar
Rank Points: 865
Registered: 03-01-2005
IP: Logged
icon Re: Use command "Wait for no build markers at" as a condition (+1)  
Good spot. Except where would you add braces, and why would that change anything? We have here switch-for-for, and the 'break' intended for the 'switch' is only exiting the inner 'for'. I'd think we need to set up a boolean variable for the result of the for loops' test and then do the STOP_COMMAND outside those loops.
11-14-2007 at 05:23 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1309
Registered: 11-24-2005
IP: Logged
icon Re: Use command "Wait for no build markers at" as a condition (0)  
Hmm... you're right. There's a double problem there in the break and the lack of braces.... that will need another variable, or at least a goto.
11-14-2007 at 03:07 PM
View Profile Show all user's posts Quote Reply
coppro
Level: Smitemaster
Rank Points: 1309
Registered: 11-24-2005
IP: Logged
icon Re: Use command "Wait for no build markers at" as a condition (0)  
Okay. Here's my revised code for that case (inside the block).
				bool bFound = false;
				//Wait until no build markers are queued in rect (x,y,w,h).
				for (UINT y=command.y; y <= command.y + command.h; ++y)
					for (UINT x=command.x; x <= command.x + command.w; ++x)
						if (room.building.get(x,y))
							bFound = true;
				if (bFound)
					STOP_COMMAND;
				bProcessNextCommand = true;

11-14-2007 at 11:41 PM
View Profile Show all user's posts Quote Reply
schep
Level: Smitemaster
Avatar
Rank Points: 865
Registered: 03-01-2005
IP: Logged
icon Re: Use command "Wait for no build markers at" as a condition (0)  
Tested the fix, and checked it in to the 3.1 code. Except I added '!bFound &&' to the for loop conditions (as more a matter of style than performance).

11-15-2007 at 12:57 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Feature Requests : Use command "Wait for no build markers at" as a condition (Cannot be done currently)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.