Commit a437c7bc authored by Julia Santos's avatar Julia Santos

Added timestamps to data logs, changed format a little

parent b884b530
......@@ -53,27 +53,31 @@ func _input_event(viewport, event, shape_idx): # executes when clicked on
func storeClick(method): # stores the mouse click data to data.save
var save_data = File.new()
var curTime = OS.get_time()
var timestamp = "[" + str(curTime.hour) + ":" + str(curTime.minute) + ":" + str(curTime.second) + "]"
if !save_data.file_exists("user://data.save"):
save_data.open("user://data.save",File.WRITE)
save_data.store_string(method + " " + get_name())
save_data.store_string(": " + method + " " + get_name() + " " + timestamp)
print("Created file")
else:
save_data.open("user://data.save",File.READ_WRITE)
save_data.seek_end()
save_data.store_string(method + " " + get_name())
save_data.store_string(": " + method + " " + get_name())
#print("Writing to file")
save_data.close()
func storeInt(selected): # specifically for using one item on another, stores mouse click data to data.save
var save_data = File.new()
var curTime = OS.get_time()
var timestamp = "[" + str(curTime.hour) + ":" + str(curTime.minute) + ":" + str(curTime.second) + "]"
if !save_data.file_exists("user://data.save"):
save_data.open("user://data.save",File.WRITE)
save_data.store_string("Used " + inventory.get_item_text(selected) + " -> " + get_name())
save_data.store_string(": Used " + inventory.get_item_text(selected) + " -> " + get_name())
print("Created file")
else:
save_data.open("user://data.save",File.READ_WRITE)
save_data.seek_end()
save_data.store_string("Used " + inventory.get_item_text(selected) + " -> " + get_name())
save_data.store_string(": Used " + inventory.get_item_text(selected) + " -> " + get_name())
#print("Writing to file")
save_data.close()
......
......@@ -370,6 +370,8 @@ margin_left = 21.0
margin_top = 20.0
margin_right = 518.0
margin_bottom = 74.0
visible_characters = 0
percent_visible = 0.0
scroll_active = false
script = ExtResource( 35 )
__meta__ = {
......
......@@ -11,14 +11,16 @@ func _unhandled_input(event): # for any input that isn't capture by UI or any ot
if event.button_index == BUTTON_LEFT and event.pressed:
if tracking: # if tracking of coordinates is enabled, turn it off to only track per-item clicks
var save_data = File.new()
var curTime = OS.get_time()
var timestamp = "[" + str(curTime.hour) + ":" + str(curTime.minute) + ":" + str(curTime.second) + "]"
if !save_data.file_exists("user://data.save"): # creates a new save file if there is none
save_data.open("user://data.save",File.WRITE)
save_data.store_string(str(event.position) + ": ")
save_data.store_string(timestamp + " " + str(event.position))
print("Created file")
else: # appends to existing save file if it does exist
save_data.open("user://data.save",File.READ_WRITE)
save_data.seek_end()
save_data.store_string("\n"+ str(event.position) + ": ")
save_data.store_string("\n"+ timestamp + " " + str(event.position))
print("Writing coordinates to file")
save_data.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment