Code: Select all
m_game->SendChatMessage("Longitude: " & longitude, CHATCHANNEL_PUBLIC);
Moderator: Defcon moderators
Code: Select all
m_game->SendChatMessage("Longitude: " & longitude, CHATCHANNEL_PUBLIC);
Code: Select all
#include <string>
#include <iostream>
using namespace std;
int main(void) {
string r1 = "No I'm not that new to C++";
string r2 = "just working with a Defcon Bot API lol";
cout << r1 << " " << r2 << endl;
}
Code: Select all
int i = 0;
if (i==0) {
m_game->PlaceStructure(3, -72, 40.75);
i++;
}
Th3xpl0iT wrote:Code: Select all
string r1 = "No I'm not that new to C++";
string r2 = "just working with a Defcon Bot API lol";
Th3xpl0iT wrote:The biggest problem I have (I got my bot to place a radar down, so I just gotta get the rest of the x,y's to place stuff in) is to have a single instance of an action. I tried:Code: Select all
int i = 0;
if (i==0) {
m_game->PlaceStructure(3, -72, 40.75);
i++;
}
But it keeps doing the same thing, even when 'i' is clearly not eq to 0.
Th3xpl0iT wrote:SendChatMessage is being a burden to use when dealing with int's, float's, etc. What's the AND type of thing I should use when including a number with a string? Example:Code: Select all
m_game->SendChatMessage("Longitude: " & longitude, CHATCHANNEL_PUBLIC);
Code: Select all
char message[32];
sprintf(message, "%s%f", "Longitude: ", longitude);
m_game->SendChatMessage(message, CHATCHANNEL_PUBLIC);
Montyphy wrote:Th3xpl0iT wrote:Code: Select all
string r1 = "No I'm not that new to C++";
string r2 = "just working with a Defcon Bot API lol";
If that were the case you wouldn't need to ask how to concatenate a string and float.Th3xpl0iT wrote:The biggest problem I have (I got my bot to place a radar down, so I just gotta get the rest of the x,y's to place stuff in) is to have a single instance of an action. I tried:Code: Select all
int i = 0;
if (i==0) {
m_game->PlaceStructure(3, -72, 40.75);
i++;
}
But it keeps doing the same thing, even when 'i' is clearly not eq to 0.
What do you mean it keeps doing the same thing? What are you expecting it to do? Are you expecting it to place different locations? All that code snippet does is place a structure in a hard coded location (without first testing if it's a valid location). The i variable can essentially be ignored since it will be initialized to 0, making the if statement true, and nothing is done with it after it's incremented.
EDIT:
Rather than using 3 to refer to a structure type you should be using the defined constant, RadarStation.
Code: Select all
int i = 0;
if (i==0) {
m_game->SendChatMessage("HELLO WORLD", CHATCHANNEL_PUBLIC);
i++;
}
Code: Select all
m_game->PlaceFleet(test_x, test_y, 8, 8, 8, 8, 8, 8);
Th3xpl0iT wrote:When I say "It does the same thing", I mean exactly that - It constantly would send "HELLO WORLD" if the code was:Code: Select all
int i = 0;
if (i==0) {
m_game->SendChatMessage("HELLO WORLD", CHATCHANNEL_PUBLIC);
i++;
}
This would become handy because I want my bot to say to the Alliance what to do according to the Defcon level (I know how to do it, except the repeat problem).
Th3xpl0iT wrote:And I suppose my most important question/problem (along with ordering an Airbase to send fighters to an x,y location >_<): Fleets. How the hell can I put a fleet into the water? It's been driving me nuts - The Constants .pdf file said that '8' was Battleship, so I would do:Code: Select all
m_game->PlaceFleet(test_x, test_y, 8, 8, 8, 8, 8, 8);
And it wouldn't appear.
EDIT: Learned how to put boats in the water lmao. Now to learn how to order Airbases, as well as switching my Silos to Nuke mode and having them launch against the enemy.
Users browsing this forum: No registered users and 1 guest