Thread Tools
Old January 22, 2001, 01:24   #1
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
I need slic help
Right now I am just trying to get the game to display a message to the human civilization the first turn. I have gotten a message to display for the americans, but it won't display for any other nations. If anyone can give me some insite to this that would be appreciated. Also, when trying to display messages for other nations, nothing happens at all, no errors or messages.

int_t DM_USA_civ;

HandleEvent(BeginTurn) 'DMStartGame_F' post {

DM_USA_civ = CivilizationIndex('AMERICANS');

if(IsHumanPlayer(g.player)) {
humanciv = PlayerCivilization(g.player);
if(humanciv == DM_USA_civ) {
humanciv2 = PlayerCivilization(g.player);
Message (1, 'USA_StartA');
DisableTrigger('DMStartGame_F');
}
}
}
kormer is offline  
Old January 23, 2001, 08:32   #2
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 11:51
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I'm not sure what you're trying to do, if you really want this message to display for the first player, you shouldn't put in a check that only displays a message if a player is American, so the code would look like this:

Code:
HandleEvent(BeginTurn) 'DMStartGame_F' post {
	if (IsHumanPlayer(player[0])) {
		humanciv2 = PlayerCivilization(player[0]); 
		Message (player[0], 'USA_StartA');
		DisableTrigger('DMStartGame_F');
	}
}
If however you want a different message to appear depending on which player the human is, you should expand the code to add more checks for nations, like this:

Code:
int_t	DM_USA_civ;
int_t	DM_France_civ;
int_t	DM_China_civ;
// etc. for all nations

HandleEvent(BeginTurn) 'DMStartGame_F' post {
	DM_USA_civ = CivilizationIndex('AMERICANS');
	DM_France_civ = CivilizationIndex('FRENCH');
	DM_China_civ = CivilizationIndex('CHINESE');
	// etc. for all nations

	if (IsHumanPlayer(player[0])) {
		humanciv = PlayerCivilization(player[0]);
		if (humanciv == DM_USA_civ) {
			humanciv2 = PlayerCivilization(player[0]); 
			Message(player[0], 'USA_StartA');
			DisableTrigger('DMStartGame_F');
		} elseif (humanciv == DM_France_civ) {
			humanciv2 = PlayerCivilization(player[0]);
			Message(player[0], 'France_StartA');
			DisableTrigger('DMStartGame_F');
		} elseif (humanciv == DM_China_civ) {
			humanciv2 = PlayerCivilization(player[0]);
			Message(player[0], 'China_StartA');
			DisableTrigger('DMStartGame_F');
		} // etc. for all nations
	}
}
Hope this helps...
Locutus is offline  
Old January 23, 2001, 12:31   #3
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
Cool thanks a lot locutus. Thats pretty much what I had before I scrapped it all. One question, you are using player[0] there, in my coding I was using g.player where you have player[0]. Whats the difference between the 2?
kormer is offline  
Old January 23, 2001, 15:23   #4
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
Locutus, I added all those checks that you mentioned and still no dice. No error messages, but also no popups for any countries. I've also tried it with both a pre and post handler. Heres an abbreviated version of the current script...

// Scenario script for Dawn of New Millenium


#include 'DM_mod.slc' // Mod Functions
#include 'DM_msg.slc'


//World Nations
//1. United States
//2. Canada
//3. Latin America
//4. South America
//5. Brazil
//6. European Union
//7. Russia
//8. China
//9. Japan
//10. Australia
//11. Indonesia
//12. India
//13. Arabia
//14. Muslim Nations
//15. Zulu
//16. West Africa

/// Abreviations
// USA - America
// CAN - Canada
// LAT - Latin America
// SAM - South America
// BRA - Brazil
// EU - European Union
// RUS - Russia
// JAP - Japan
// CHI - China
// AUS - Australia
// POL - Indonesia
// IND - India
// ARB - Arabia
// MUS - Muslim
// ZUL - Zulu
// WAF - Western Africa

///////////////////////////////////////////////////////////////
///////////GLOBAL VARIABLES////////////////////////////////////
///////////////////////////////////////////////////////////////

int_t humanciv; // keeps track of human player
int_t humanciv2;

//////////////////////////////////////////
////Variables to track human civindex/////
//////////////////////////////////////////


int_t DM_USA_civ;
int_t DM_CAN_civ;
int_t DM_LAT_civ;
int_t DM_SAM_civ;
int_t DM_BRA_civ;
int_t DM_EU_civ;
int_t DM_RUS_civ;
int_t DM_JAP_civ;
int_t DM_CHI_civ;
int_t DM_AUS_civ;
int_t DM_POL_civ;
int_t DM_IND_civ;
int_t DM_ARB_civ;
int_t DM_MUS_civ;
int_t DM_ZUL_civ;
int_t DM_WAF_civ;


HandleEvent(BeginTurn) 'DMStartGame_F' post {

// Inizatializes variables to track civ index
DM_USA_civ = CivilizationIndex('AMERICANS');
DM_CAN_civ = CivilizationIndex('CANADIANS');
DM_LAT_civ = CivilizationIndex('MEXICO');
DM_SAM_civ = CivilizationIndex('NATIVE_AMERICAN');
DM_BRA_civ = CivilizationIndex('BRAZIL');
DM_EU_civ = CivilizationIndex('ENGLISH');


if (IsHumanPlayer(player[0])) {
humanciv = PlayerCivilization(player[0]);
if (humanciv == DM_USA_civ) { humanciv2 = PlayerCivilization(player[0]); Message(player[0], 'USA_StartA'); DisableTrigger('DMStartGame_F');
} elseif (humanciv == DM_CAN_civ) {

humanciv2 = PlayerCivilization(player[0]); Message(player[0], 'CAN_StartA'); DisableTrigger('DMStartGame_F');
} elseif (humanciv == DM_LAT_civ) {

humanciv2 = PlayerCivilization(player[0]); Message(player[0], 'LAT_StartA'); DisableTrigger('DMStartGame_F');
} }

}
kormer is offline  
Old January 23, 2001, 16:15   #5
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 11:51
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Hmm, odd. I don't see any reason why this shouldn't work. Try replacing player[0] with a user-defined variable, like below. I don't see why it should make a difference but that's how I always do it. (See code below)

The difference between player[0] and g.player is that g.player is the player who's turn begins and g.player is the current player. Normally this should be the same but one can imagine that a player has an extremely short turn and it's turn is over before the code processed all g.player instances of the SLIC code. If that is the case, the SLIC code may refer to player 3 while player 2 was intented by the programmer. I know, it's highly unlikely that this would ever happen but my saying is: better safe than sorry. If the tmpPlayer thing doesn't work, you could consider using g.player instead, though I don't think it will make much of a difference.

A last resort would be to use 1 instead of player[0] or g.player when you display the message (like you did earlier), but since you're probably using this code in the modern scenario, I'm not sure if the human player is always player 1.

Code:
HandleEvent(BeginTurn) 'DMStartGame_F' post {
int_t	tmpPlayer;
	tmpPlayer = player[0];

	// Inizatializes variables to track civ index
	DM_USA_civ = CivilizationIndex('AMERICANS');
	DM_CAN_civ = CivilizationIndex('CANADIANS');
	DM_LAT_civ = CivilizationIndex('MEXICO');
	DM_SAM_civ = CivilizationIndex('NATIVE_AMERICAN');
	DM_BRA_civ = CivilizationIndex('BRAZIL');
	DM_EU_civ = CivilizationIndex('ENGLISH');

	if (IsHumanPlayer(tmpPlayer)) {
		humanciv = PlayerCivilization(tmpPlayer);
		if (humanciv == DM_USA_civ) {
			humanciv2 = PlayerCivilization(tmpPlayer);
			Message(tmpPlayer, 'USA_StartA');
			DisableTrigger('DMStartGame_F');
		} elseif (humanciv == DM_CAN_civ) { 
			humanciv2 = PlayerCivilization(tmpPlayer);
			Message(tmpPlayer, 'CAN_StartA');
			DisableTrigger('DMStartGame_F');
		} elseif (humanciv == DM_LAT_civ) {
			humanciv2 = PlayerCivilization(tmpPlayer);
			Message(tmpPlayer, 'LAT_StartA');
			DisableTrigger('DMStartGame_F');
		}
	}
}
Locutus is offline  
Old January 23, 2001, 16:45   #6
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
Thanks for the help, but I just put in the tmpPlayer coding and that gave me the same results...none.
kormer is offline  
Old January 23, 2001, 17:14   #7
Dale
Emperor
 
Dale's Avatar
 
Local Time: 19:51
Local Date: October 31, 2010
Join Date: Dec 2000
Posts: 3,944
I know this may be obvious, but you did use an #import command on your text string file in strings.txt? That's the only reason I can see for this to fail.

------------------
Author of Diplomod. The mod to fix diplomacy.

Rommell to a sub-commander outside Tobruk: "Those Australians are in there somewhere. But where? Let's advance and wait till they shoot, then shoot back."
Dale is offline  
Old January 23, 2001, 17:41   #8
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
My strings are all ing scen_str.txt, which is imported in the default strings.txt file, but just to make sure I copied it into my scenario folder, same result however. Besides, if it didn't import my strings text, then it would give errors saying it can't find any strings right? Thanks for the help though dale, and always check the obvious, just because it is to you, doesn't mean it isn't obvious to someone else.
kormer is offline  
Old January 23, 2001, 18:53   #9
Dale
Emperor
 
Dale's Avatar
 
Local Time: 19:51
Local Date: October 31, 2010
Join Date: Dec 2000
Posts: 3,944
kormer:
Yeah, I know about the obvious things. I work on a helpdesk. You wouldn't believe some of the questions I get asked.

Had a second thought on this, in your message function, I'd try using a Show(); command to force it open. If that doesn't work you know it ain't getting to the message function and must be something to do with the caller reference.

------------------
Author of Diplomod. The mod to fix diplomacy.

Rommell to a sub-commander outside Tobruk: "Those Australians are in there somewhere. But where? Let's advance and wait till they shoot, then shoot back."
Dale is offline  
Old January 23, 2001, 19:18   #10
kormer
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Jan 2001
Posts: 58
Dale, I was using the show function, but you were right, it wasn't getting to the message function!!! I put in a mod from alexander to not allow wonders to be built, and I noticed that wasn't working. Then I decided to take the #includes out, that made all kinds of errors. Then I put them back in at the bottom of the file, and I got more errors, but not the same ones. I found a few spelling errors and such so I know it was parsing the entire file now. The error I am stuck on now is, could not find 'americans' in asset tree, and thats in reference to the civilizationindex() function. Also, is there any difference between " and '. I've noticed several different places reference civilizationindex("nation") and civilizationindex('nation'). And lastly, I'm on a roll here, where should each of my #includes be in the file? Right now I have one for diplomod, a mod for wonders, and my msgs.
kormer is offline  
Old January 23, 2001, 20:59   #11
Dale
Emperor
 
Dale's Avatar
 
Local Time: 19:51
Local Date: October 31, 2010
Join Date: Dec 2000
Posts: 3,944
In reference to Diplomod, the script file directly replaces diplomacy.slc, so replacing #include "diplomacy.slc" with #include "diplomod.slc" works fine. As for other mods, it would be determined by global variable and function calls. Can't call a something if it's defined in a later file type stuff. (I think)

As to the civindex error, I got no idea.

------------------
Author of Diplomod. The mod to fix diplomacy.

Rommell to a sub-commander outside Tobruk: "Those Australians are in there somewhere. But where? Let's advance and wait till they shoot, then shoot back."
Dale is offline  
Old January 24, 2001, 02:37   #12
Alpha Wolf
Chieftain
 
Local Time: 09:51
Local Date: October 31, 2010
Join Date: Feb 2001
Location: Prince of the Barbarians
Posts: 0
Hey Dale,
i'm trying to scan this page but no matter how long I hold it up to the screen, it just wont scan.

Sorry, worked a helpdesk before, and I WOULD believe the questions you get....LOL

------------------
History is written by the victor.
Alpha Wolf is offline  
Old January 24, 2001, 11:50   #13
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 11:51
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
For messages it shouldn't make a difference where they are imported AFAIK, but functions always have to be defined before you can use them, so you need to place or import them near the top of your SLIC files. Same goes for global variables. And yes, it makes a big difference whether you use ' or ". The savest thing to do is just to put everything in one file, so if you're not sure, that's the way to go.
Locutus is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:51.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team