hi, you could check the source of this mod: http://ugbase.eu/Thread-CLEO-statDisplay
the key parts to look at within the code:
getting the name of the area (and calling the drawing function)
Code:
00A0: store_actor $PLAYER_ACTOR position_to PLAYER_POS_X PLAYER_POS_Y PLAYER_POS_Z
0843: get_zone_at PLAYER_POS_X PLAYER_POS_Y PLAYER_POS_Z nameA_to GTX_ZONENAME
0ADE: STR_ZONE = text_by_GXT_entry GTX_ZONENAME
0AB1: @Draw 7 FONT FONT_SIZE STR_ZONE DISPLAY_POS_X DISPLAY_POS_Y_BUFF 0xFFFFFFFF ALIGNMENT _ret DISPLAY_POS_Y_BUFF
drawing function (DISPLAY_POS_Y_BUFF is returned because the mod displays other values too so each value has to be drawn below the previous one, it could be deleted if you'd like to draw only the zone name)
Code:
:Draw
0012: 1@ *= 10
0016: 1@ /= 7
005A: 4@ += 1@ // (int)
if 6@ == 0 // left
then
0B6F: render 0@ draw_text 2@ of pos 3@ 4@ color 5@
else
0B6B: render 30@ = 0@ get_length_of 2@
if 6@ == 1 //center
then
0016: 6@ /= 2
end
0085: 29@ = 3@
0062: 29@ -= 30@
0B6F: render 0@ draw_text 2@ of pos 29@ 4@ color 5@
end
0AB2: ret 1 4@
assigning variables to text at the begining of the script
Code:
const
FONT = 0@
STR_ZONE = 4@
DISPLAY_POS_X = 12@
DISPLAY_POS_Y = 13@
DISPLAY_POS_Y_BUFF = 14@
STR_FONT_NAME = 16@
FONT_SIZE = 18@
FONT_FLAGS = 19@
ALIGNMENT = 20@
GTX_ZONENAME = s$93
end
alloc STR_ZONE 64
alloc STR_FONT_NAME 64
how these variables were actually defined
Code:
if 0AAB: file_exists "CLEO\statDisplaySettings.ini"
then
ARRAY_TOG = 0
0AF4: STR_FONT_NAME = read_string_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "font_name"
0AF0: DISPLAY_POS_X = get_int_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "x"
0AF0: DISPLAY_POS_Y = get_int_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "y"
0AF0: FONT_SIZE = get_int_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "font_size"
0AF0: FONT_FLAGS = get_int_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "font_flags"
0AF0: ALIGNMENT = get_int_from_ini_file "CLEO\statDisplaySettings.ini" section "Settings" key "alignment"
else
0AF8: samp add_message_to_chat "{F7F694}CLEO\statDisplaySettings.ini {FF4800}not found. {F7F694}The mod won't work"
end