What the hell happened to your ant game? It looked pretty good and seemed to be almost completed...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuoteI'm a little puzzled by your attitude to just give up when you come across some minor problem with a solutionHow cold, the thing he's trying to achieve can't be done with the module he's using, and I'm sure you can tell (from his code) he doesn't know enough to find out a workaround by himself.
function room_RepExec()
{
if(warlock_event == 1)
{
if(text1 != null && text1.Valid && !cWarlock.Animating)
{
cWarlock.Animate(talk_view, talk_loop, eOnce, eNoBlock); //if warlock is saying text in bg and is not animating, animate him
}
if(current_line > 4) { //change to the max number of lines
current_line=0; // When the warlock finishes his rant, he will begin again from the start
}
if(!interrupted)
{
if(text1 == null || !text1.Valid)
{
text1 = cWarlock.SayBackground(Lines[current_line]);
current_line++;
}
}
else
{
text1 = cWarlock.SayBackground("Now where was I? Ah yes...");
current_line--;
interrupted = false;
}
}else if(warlock_event == 2)
{
// This will play a cutscene that will start after you return from a dialog which contains warlock_event=true; at the end
// And carry on with the rest of the game...
}
}
String Lines[10];
int current_line;
bool warlock_event;
bool interrupted;
Overlay *text1;
Lines[0] = "Hello young man";
Lines[1] = "how are you";
Lines[2] = "can I help you in any way?";
if(warlock_event)
{
if(current_line > 2) //event stops when warlock has said his last line (Lines[2])
warlock_event = false;
if(!interrupted) //if the player isn't interrupting
{
if(text1 == null || !text1.Valid) //if previous background text is gone
{
text1 = warlock.SayBackground(Lines[current_line]); //say the line
current_line++;
}
}
else //player has interrupted, skip current line, say interrupt text, and go back to previous line
{
text1 = warlock.SayBackground("You're interrupting me! What was I saying... Ah...");
current_line--;
interrupted = false;
}
}
warlock_event = true;
interrupted = true;
//Copy to: top of the script outside functions
String Lines[10];
int current_line;
bool warlock_event; //true: the event is active
bool interrupted;
Overlay *text1;
//Copy to: game_start()
Lines[0] = "Hello young man";
Lines[1] = "how are you";
Lines[2] = "can I help you in any way?";
warlock_event = true;
//Copy to: repeatedly_execute()
if(warlock_event)
{
if(current_line > 2) //event stops when warlock has said his last line (Lines[2])
warlock_event = false;
if(!interrupted) //if the player isn't interrupting
{
if(text1 == null || !text1.Valid) //if previous background text is gone
{
text1 = warlock.SayBackground(Lines[current_line]); //say the line
current_line++;
}
}
else //player has interrupted, skip current line, say interrupt text, and go back to previous line
{
text1 = warlock.SayBackground("You're interrupting me! What was I saying... Ah...");
current_line--;
interrupted = false;
}
}
warlock_event = true;
interrupted = true;
Quote from: Atelier on Wed 30/05/2012 21:10:52Sorry I've seen your topic a bit late.
I have a confession - I started working on a solution before I saw your reply
if(GetParserAction(parser_string) > 0)
{
if(ParserCommand == "look")
{
if(ParserTargetType == "character")
{
//Display(character[ParserTargetID].Name);
}
else if(ParserTargetType == "object")
{
//Display(object[ParserTargetID].Name);
}
}
else if(ParserCommand == "talk")
{
if(ParserTargetType == "character")
{
//talk to: character[ParserTargetID]
}
else if(ParserTargetType == "object")
{
//talk to: object[ParserTargetID]
}
}
else if(ParserCommand == "fight")
{
if(ParserTargetType == "character")
{
//fight: character[ParserTargetID]
}
else if(ParserTargetType == "object")
{
//fight: object[ParserTargetID]
}
}
}
GetParserAction("fight sep");
GetParserAction("hit sephi");
GetParserAction("strike sephiroth");
//if no other character share the same name it will return 1 and fill Globals with appropriate values
ParserCommand -> "fight"
ParserTargetType -> "character"
ParserTargetID -> char_id
int GetItemsCount(String the_str, char separator)
{
int cnt = 0;
int i = 0;
while(i < the_str.Length)
{
if(the_str.Chars[i] == separator)
cnt++;
i++;
}
return cnt;
}
String GetItem(String the_str, int the_id, char separator)
{
int i = 0;
int cnt = 0;
int last_cnt = 0;
String result;
while(i<the_str.Length)
{
if(the_str.Chars[i] == separator)
{
cnt++;
if(cnt == the_id)
{
if(!last_cnt)
result = the_str.Substring(last_cnt, i-last_cnt);
else
result = the_str.Substring(last_cnt+1, i-last_cnt-1);
return result;
}
last_cnt = i;
}
i++;
}
return "";
}
int GetParserAction(String input)
{
String excluded = "the,it,for,to,of,at,";
String syn_look ="look,lookat,watch,see,examine,";
String syn_talk ="talk,speak,";
String syn_fight ="fight,attack,hit,strike,";
ParserCommand = "none";
ParserTargetType = "none";
ParserTargetID = -1;
int match_id = -1;
input = input.AppendChar(' ');
if(GetItemsCount(input, ' ') <2)
return -1;
String command = GetItem(input, 1, ' ');
String target = GetItem(input, 2, ' ');
//Figure out which command the player typed
int i = 1;
int j = 0;
int count = 0;
count = GetItemsCount(syn_look, ',');
i = 1;
while(i<=count)
{
if(command == GetItem(syn_look, i, ',' ))
ParserCommand = "look";
i++;
}
if(ParserCommand == "none")
{
count = GetItemsCount(syn_talk, ',');
i = 1;
while(i<=count)
{
if(command == GetItem(syn_talk, i, ',' ))
ParserCommand = "talk";
i++;
}
}
if(ParserCommand == "none")
{
count = GetItemsCount(syn_fight, ',');
i = 1;
while(i<=count)
{
if(command == GetItem(syn_fight, i, ',' ))
ParserCommand = "fight";
i++;
}
}
if(ParserCommand == "none")
return -2;
//Make sure the target isn't an excluded term
i = 1;
count = GetItemsCount(excluded, ',');
while(i<=count)
{
if(target == GetItem(excluded, i, ','))
return -3;
i++;
}
//Cycle through room OBJECT names
i = 0;
count = 0;
while(i<Room.ObjectCount)
{
if(object[i].Name.IndexOf(target) >= 0)
{
ParserTargetType = "object";
ParserTargetID = i;
count++;
}
i++;
}
if(count>1)
return -4;
else if(count == 1)
return 1;
//Cycle through CHARACTER names
i = 0;
count = 0;
while(i<Game.CharacterCount)
{
if(character[i].Room == player.Room && character[i].Name.IndexOf(target) >= 0)
{
ParserTargetType = "character";
ParserTargetID = i;
count++;
}
i++;
}
if(count>1)
return -4;
else if(count == 1)
return 1;
return -5;
}
int GetItemsCount(String the_str, char separator)
{
int cnt = 0;
int i = 0;
while(i < the_str.Length)
{
if(the_str.Chars[i] == separator)
cnt++;
i++;
}
return cnt;
}
String GetItem(String the_str, int the_id, char separator)
{
int i = 0;
int cnt = 0;
int last_cnt = 0;
String result;
while(i<the_str.Length)
{
if(the_str.Chars[i] == separator)
{
cnt++;
if(cnt == the_id)
{
if(!last_cnt)
result = the_str.Substring(last_cnt, i-last_cnt);
else
result = the_str.Substring(last_cnt+1, i-last_cnt-1);
return result;
}
last_cnt = i;
}
i++;
}
return "";
}
int GetParserTargetID(String input)
{
String excluded = "the,it,for,to,of,at,";
String syn_look ="look,lookat,watch,see,examine,";
input = input.AppendChar(' ');
if(GetItemsCount(input, ' ') <2)
return -1;
String input_item = GetItem(input, 2, ' ');
int i = 1;
int j = 0;
int count = 0;
count = GetItemsCount(excluded, ',');
while(i<=count) //if input is an exluded term, return
{
if(input_item == GetItem(excluded, i, ','))
return -2;
i++;
}
count = GetItemsCount(syn_look, ',');
i = 1;
while(i<=count) //for all look synonyms
{
if(input.StartsWith(GetItem(syn_look, i, ',' )))
{
j = 0;
while(j<Room.ObjectCount) //for all objects in room
{
if(object[j].Name.IndexOf(input_item) >=0) //if one of the terms match the object's name return its ID
return j;
j++;
}
}
i++;
}
return -3;
}
//GuiDialogChoice - the Gui
//ChoicesBox - the Listbox
//global variable
int DialogChoice;
//repeatedly execute always
if(GuiDialogChoice.Visible)
{
int base_height = ChoicesBox.Height/3;
if(mouse.x > GuiDialogChoice.X + ChoicesBox.X &&
mouse.x < GuiDialogChoice.X + ChoicesBox.X + ChoicesBox.Width)
{
if(mouse.y > GuiDialogChoice.Y + ChoicesBox.Y &&
mouse.y < GuiDialogChoice.Y + ChoicesBox.Y + base_height)
{
ChoicesBox.SelectedIndex=0;
if(mouse.IsButtonDown(eMouseLeft))
DialogChoice = 1;
}
else if(mouse.y > GuiDialogChoice.Y + ChoicesBox.Y + base_height &&
mouse.y < GuiDialogChoice.Y + ChoicesBox.Y + (base_height *2) &&
ChoicesBox.ItemCount > 1)
{
ChoicesBox.SelectedIndex=1;
if(mouse.IsButtonDown(eMouseLeft))
DialogChoice = 2;
}
else if(mouse.y > GuiDialogChoice.Y + ChoicesBox.Y + (base_height*2) &&
mouse.y < GuiDialogChoice.Y + ChoicesBox.Y + (base_height*3) &&
ChoicesBox.ItemCount > 2)
{
ChoicesBox.SelectedIndex=2;
if(mouse.IsButtonDown(eMouseLeft))
DialogChoice = 3;
}
}
}
//the blocking function
int GetDialogChoice()
{
DialogChoice = 0;
GuiDialogChoice.Visible = true;
while(!DialogChoice)
Wait(GetGameSpeed()/10);
GuiDialogChoice.Visible = false;
return DialogChoice;
}
Quote from: Pablo on Mon 23/01/2012 13:30:31I want that too, and the game on a 12+ floppy disks set!
I must get a boxed collector's edition of this game with that statue included!
//global outside functions, preferably top of globalscript
DrawingSurface *CurrentMap;
//room load
DynamicSprite *MapSprite = DynamicSprite.CreateFromExistingSprite(10); //the sprite number corresponding to the colored zones image
CurrentMap = MapSprite.GetDrawingSurface();
//room leave
CurrentMap.Release();
MapSprite.Delete();
//check pixel color at hero coords
CurrentMap.GetPixel(cEgo.X, cEgo.Y);
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.058 seconds with 16 queries.