Output Room Number & Coordinates to a log file

Started by Fritos, Mon 19/04/2004 06:25:53

Previous topic - Next topic

Fritos

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

ElectricMonk

#1
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 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.

Gilbert

#2
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.

Fritos

#3
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.

SMF spam blocked by CleanTalk