Author Topic: Using Hastechnology()  (Read 2465 times)

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Using Hastechnology()
« on: March 03, 2006, 05:21:59 PM »
I've been trying to create some code that does something if a player has researched rare ore, and something else if the player hasn't. I can't get HasTechnology() to work for me. Could someone post and example of it working?

Edit: I figured it out, I was getting the tech from the .txt file, not the header. The numbers in the .txt have an extra 0 in the front.
« Last Edit: March 04, 2006, 03:27:46 PM by Mcshay »

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
Using Hastechnology()
« Reply #1 on: March 05, 2006, 10:56:30 AM »
?
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Using Hastechnology()
« Reply #2 on: March 05, 2006, 11:04:05 AM »
When I was looking for the tech to use with that function, I didn't know there was a header with them defined. I was opening the tech file and looking in there. They are listed differently in the tech file.
« Last Edit: March 05, 2006, 11:05:22 AM by Mcshay »

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
Using Hastechnology()
« Reply #3 on: March 05, 2006, 12:56:06 PM »
errrrrr..   "?"


[EDIT]
Player[0].HasTechnology(techMicrowave)  <- should work
« Last Edit: March 05, 2006, 01:00:04 PM by Eddy-B »
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Using Hastechnology()
« Reply #4 on: March 05, 2006, 01:22:30 PM »
Oh, I was putting in the numbers.

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Using Hastechnology()
« Reply #5 on: March 05, 2006, 03:44:22 PM »
You can still put the numbers, just be sure that you don't put any 0's before the tech ID.

That is, if the techfile says 00210 as a research ID, get rid of the leading zeros.

(In C++, any number prefixed with 0 is an octal (base 8) number. Tech IDs are decimal (base 10) however).

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Using Hastechnology()
« Reply #6 on: March 05, 2006, 03:46:20 PM »
Thanks, that fixed it.