Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Fritos on Mon 19/04/2004 06:25:53

Title: Output Room Number & Coordinates to a log file
Post by: Fritos on Mon 19/04/2004 06:25:53
I currently have a parser that outputs evething someone types to a log file, so I can then later go back and read what they have have typed to better understand what they may have been interested in viewing/doing in the room.

What I would like to do is also have it output what room they where in, and what coordinates they where at when they typed into the parser. The format I'm looking for is this:

Room 1 : X=150, Y=90 : Look at apple
Room 8 : X=49, Y=124: Look at tree
Room 4 : X=22. Y=45: Use rock with apple

I hope this makes since, and am wondering if this is possible and would appreciate any assistance. TIA
Title: Re:Output Room Number & Coordinates to a log file
Post by: ElectricMonk on Mon 19/04/2004 06:41:35
I'm not quite sure what kind of assistance you require (how to get the variables? the complete script that turns the whole thing into a text file? how to format the string?), but this recent thread (http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=13260) might help you in obtaining the current room number from the game.
The global variables character[CHARID].x and character[CHARID].y will return the character location values you want.
Title: Re:Output Room Number & Coordinates to a log file
Post by: Gilbert on Mon 19/04/2004 06:43:23
I think you do this by opening a file to write strings to it, right?

In that case, do something like (warning: very rough codes, needs polishing to fit your own game's settings) below accompanying the actions you want the game to log:

StrFormat (tmpstr, "Room %d : X=%d, Y=%d : Look at %s",player.room,player.x,player.y, locationname)
FileWriteRawLine(handle,tmpstr);

(where tmpstr is a string variable, and locationname is another string which holds the name of the location clicked)

Note: it's just the idea, it's by no mean complete or working codes.
Title: Re:Output Room Number & Coordinates to a log file
Post by: Fritos on Tue 20/04/2004 03:31:04
Actually Gilbot, your code worked perfectly. I just changed the names of the strings to what I was using in my code, and it did exactly how I origionally wanted it. Thanks.