Sorry for my English.
What I need to:
We have 2 scenes: “base” and “HUD”. On the 1st one we have many similar 3d-models of “nameplates” (see pic). When a player is nearby of one of them, and looking at that nameplate, it’s activate an overlay scene “HUD” with a specific data:
(1 line) Name, Surname<br>
(2 line) Date<br>
(3 line) something else…
Nameplates (there should be many of them):
Example of data in overlay plane:
These nameplates should contain a different data (Names, surnames, etc.). And there can be a hundreeds of these nameplates, so I need a flexible way to insert these data and change. Is it real to make this only via logic (change string properties or smth)?
We tried to solve it via logic, but couldn’t because there was no a problem with 1 nameplate. I transmitted (copy) data from property of nameplate to Text on the “HUD” scene, but if you have more than 1 nameplate with the same logic (dublicates), all data willn’t appear.
We tried to make it through python but we haven’t enough knowledge.<br>We created 2 Excel files:
-
contain info about people
-
contain ID of people and ID of nameplates:
(sorry, can’t attach more than 3 images)
ID_NP | ID_ST
Gre.001 | s001
Red.001 | s003
…
We exported these files to .csv and tried to make a connection between data about people and ID’s of nameplates (3d-models) via python.
import bge, csv
from bge import logic
gd=logic.globalDict
def lib_load(blend_file):
logic.LibLoad(logic.expandPath("//")+"/"+blend_file, "Scene")
def db_import(csv_file, db_type):
db=csv.reader(open(logic.expandPath("//")+"/" +csv_file,"r"), delimiter=";")
is_header=True
temp_dict={}
temp_dict2={}
for row in db:
if is_header:
header=row
is_header=False
else:
for col in range (1,len(row)):
temp_dict[header[col]]=row[col]
temp_dict2[row[0]]=temp_dict
temp_dict={}
gd[db_type]=temp_dict2
logic.saveGlobalDict()
db_import("db_students.csv","students")
db_import("db_connect.csv","connection")
def db_test():
ConInfo = csv.reader(open(logic.expandPath("//")+"/db_connect.csv","r"),delimiter=";")
Student = csv.reader(open(logic.expandPath("//")+"/db_connect.csv","r"),delimiter=";")
is_header=True
for row in ConInfo:
if is_header:
header=row
is_header=False
else:
for col in range (1,len(row)):
#I don't know what to do in this place
#if col[1] from ConInfo == col[0] from Student:
# print(row)
db_test()
Please, help!