Yes. I'm having trouble again.
I'm having a problem with GetGlobalString.Ã, I do a bit of experimenting and find out that I need another factor. The problem is that I have NO idea what I need to do.
#sectionstart game_startÃ, // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
SetGlobalInt(6,0);//Placeholder1
SetGlobalInt(7,10);//Health, used for battle and non-battle
SetGlobalInt(8,0);//Money
SetGlobalInt(9,0);//Placeholder2
SetGlobalString(11,"none");//Equipped Melee Weapon (eg knife)
SetGlobalString(19,"none");//Equipped Ranged Weapon (eg glock)
SetGlobalInt(12,0);//Attack Points, set at start of battle
SetGlobalInt(13,0);//Enemy Health, set at start of battle
SetGlobalInt(14,0);//Enemy Atk. Points, set at start of battle
SetGlobalInt(15,0);//Enemy Melee Weapon
SetGlobalInt(16,0);//Enemy Ranged weapon
SetGlobalInt(17,0);//Ammo of equipped ranged weapon
SetGlobalInt(18,0);//Ammo of enemy's equipped ranged weaponÃ, Ã,Â
// called when the game starts, before the first room is loaded
Ã, Ã, }
#sectionend game_startÃ, // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
Ã, string money;
Ã, string health;
Ã, string meleeweapon;
Ã, string rangedweapon;
Ã, string ammo;
Ã, string attackpoints;
Ã, string enemyhealth;
Ã, string enemyattackpoints;
Ã, StrFormat(money,"%d",GetGlobalInt(8));
Ã, StrFormat(health,"%d",GetGlobalInt(7));
Ã, StrFormat(meleeweapon,"%s",GetGlobalString(11));
Ã, StrFormat(rangedweapon,"%s",GetGlobalString(19));
Ã, StrFormat(ammo,"%d",GetGlobalInt(17));
Ã, StrFormat(attackpoints,"%d",GetGlobalInt(12));
Ã, StrFormat(enemyhealth,"%d",GetGlobalInt(13));
Ã, StrFormat(enemyattackpoints,"%d",GetGlobalInt(14));
Ã, SetLabelText(0,4,health);
Ã, SetLabelText(0,2,money);
Ã, SetLabelText(3,0,health);
Ã, SetLabelText(3,1,meleeweapon);
Ã, SetLabelText(3,2,rangedweapon);
Ã, SetLabelText(3,3,ammo);
Ã, SetLabelText(3,5,attackpoints);
Ã, SetLabelText(3,4,enemyhealth);
Ã, SetLabelText(3,6,enemyattackpoints);Ã,Â
Ã,Â
Ã,Â
Ã, // put anything you want to happen every game cycle here
}
#sectionend repeatedly_executeÃ, // DO NOT EDIT OR REMOVE THIS LINE
Quote from: ags_newbie on Thu 15/12/2005 23:59:31I do a bit of experimenting and find out that I need another factor.
Can you please explain in more detail what you want to do?
And please, if you're not sure where to post, please post in the Beginners Forum first.
If your question cannot be answered there, it will be moved to the Technical Forum. The main Technical Forum is reserved for advanced questions and bug reports.
Thank you.
At a guess, I'd say the problem was here:
StrFormat(meleeweapon,"%s",GetGlobalString(11));
StrFormat(rangedweapon,"%s",GetGlobalString(19));
Read the manual, the usage for
GetGlobalString() is:
Quote
GetGlobalString
GetGlobalString (int index, string buffer)
Copies the current Global String INDEX into BUFFER. See SetGlobalString for more information.
Example:
string buffer;
GetGlobalString (15, buffer);
So, those above lines should be:
GetGlobalString (11, meleeweapon);
GetGlobalString (19, rangedweapon);
NOTE: I'm assuming you're
not using V2.71.
In 2.71 it's Game.GlobalStings[index]...or something like that.
Thanks!
(I'm using AGS 2.61)