More Questions About Scripting

Gwenio

New member
Joined
Jan 8, 2010
Messages
6
First:
What type(s) would a mine be classified as when trying to locate one near a location?
Second:
What types would ore rocks be?

A sample of the script I am working on to help clairify if need be:
Code:
Target = get SCRIPT_OBJECT_TYPE_MOBILE_STATIC MOBILE_STATIC_INFO_ORE_ROCK at {Town} radius Rad

PS: The black text this site uses for the edit boxes does not work well with the really dark purple I have Windows set to use for the background of appications (which is aslo the color for text boxes). Either set both the text color and the background, or set neither. Setting one and not the other can cause problems.
 
Hi, I never tried looking for a mine before. But it looks it could be SCRIPT_OBJECT_TYPE_MINE (ScriptEnums.h)

The ore rocks are mobile statics.

PS: The black text this site uses for the edit boxes does not work well with the really dark purple I have Windows set to use for the background of appications (which is aslo the color for text boxes). Either set both the text color and the background, or set neither. Setting one and not the other can cause problems.

Have you got a screenshot?

 
The script object type mine does not work (I have tries, with a radius that far exceeded what would be needed, and the smae goes for ore rocks. It is looking like I will  try them again, but it looks like I may have to have an array of mine locations and forget about picking up ore rocks for the god AI I am working on...

Screen shot attached.
 
As I mentioned, I haven't needed to locate a mine before and that was all I could find.

As for the graphics thing, that's all driven by the style sheet. I've added a background colour to some of the input boxes, but I don't want to touch the buttons. Try switching to one of the darker themes in your profile.
 
The fact that I cannot get it to find ore rocks will be more of a problem than the mines, as an array of markers for their location can be created. More work though.
 
I've been trying to do things with mines in a script, but haven't had much luck yet.
Anyone know of a way to set the ore amount of a particular mine with a script?

Code:
begin script OreMineScript

	OreMine1 = get SCRIPT_OBJECT_TYPE_MINE at {wherever}

start

begin loop

if Whatever == Whatever
set OreMine1 resource RESOURCE_TYPE_ORE to 5000
end if

end loop

end script OreMineScript

That doesn't seem to do what I want it to though.
 
You can set it in the editor.

As I mentioned before, I've not had the opportunity to find a mine.

Code:
OreMine1 = get SCRIPT_OBJECT_TYPE_MINE at {wherever}

Test to see if OreMine1 exists. Use an if statement and increment tribute if true.
 
I really want to be able to set the ore value in the mines using scripts.
The one I'm working on compiles, but doesn't do anything.
I'm pretty sure I tried what you suggested, but maybe I didn't, or did it wrong...

Code:
begin script OreMineScript

OreMine1 = get SCRIPT_OBJECT_TYPE_MINE at {wherever}

start

begin loop

if OreMine1 exists
set OreMine1 resource RESOURCE_TYPE_ORE to 5000
end if

end loop

end script OreMineScript

I don't think that worked though.
I was just wondering if anyone had done it and could share how.
 
If you replace set OreMine1 resource RESOURCE_TYPE_ORE to 5000 with an increment tribute then you can see if it it returns with a value.

Something else, you have that in a loop with no condition to exit it. So it will just keep looping
 
Here's the main part of the script...

Code:
begin script OreMineTest

	PlayerTown = get town with id 0
	OreMine1 = 0

start

OreMine1 = get SCRIPT_OBJECT_TYPE_MINE at {pos}
TownTechLevel = get tech level of town PlayerTown //global variable

begin loop
	if TownTechLevel == 0 and TechLevel0Set != 1
		set OreMine1 resource RESOURCE_TYPE_ORE to 5000
		wait 1 seconds
		begin dialogue
		  say "OreMine1 set to 5000"
		  wait 2 seconds
		  close dialogue
		  clear dialogue
		end dialogue
		TechLevel0Set = 1 //global variable

	elsif TownTechLevel == 1 and TechLevel1Reached != 1
		set OreMine1 resource RESOURCE_TYPE_ORE to 10000
		wait 1 seconds
		begin dialogue
		  say "OreMine1 set to 10000"
		  wait 2 seconds
		  close dialogue
		  clear dialogue
		end dialogue
		TechLevel1Reached = 1

	elsif TownTechLevel == 2 and TechLevel2Reached != 1
		set OreMine1 resource RESOURCE_TYPE_ORE to 20000
		wait 1 seconds
		begin dialogue
		  say "OreMine1 set to 20000"
		  wait 2 seconds
		  close dialogue
		  clear dialogue
		end dialogue
		TechLevel2Reached = 1

	elsif TownTechLevel == 3 and TechLevel3Reached != 1
		set OreMine1 resource RESOURCE_TYPE_ORE to 50000
		wait 1 seconds
		begin dialogue
		  say "OreMine1 set to 50000"
		  wait 2 seconds
		  close dialogue
		  clear dialogue
		end dialogue
		TechLevel3Reached = 1
	end if

until TechLevel3Reached == 1
end loop

 
I threw this loop in for testing...
Code:
begin loop

	if OreMine1 != 0
	  increment tribute by 5000
	  MineCheckSuccess = 1

	elsif OreMine1 == 0
	  wait 0.2 seconds
	  begin dialogue
	    say "Can't find the mine... damnit"
	    wait 2 seconds
	    close dialogue
	    clear dialogue
	  end dialogue
	  MineCheckFailed = 1
	end if

until MineCheckSuccess == 1
end loop

it never finds the mine...
 
Sorry for hijacking your thread, Gwenio...
I figured I'd post here since I'm having a very similar problem.
 
Very quickly looking at it. In the first code is {pos} defined?

For the second code to check you should use if OreMine1 exists (I think that's the proper syntax, it's been a while)
 
Yeah, {pos} is defined... I've also tried it with a radius.
And I used 'if OreMine1 != 0' just because it starts out set to 0 so I figured it should work either way.

I'm really stuck on this one, and I see I'm not alone.
Maybe there's just no way to find a mine with a script???
I'm trying to figure out some kind of workaround if the current plan doesn't pan out.
 
Back
Top