("zoom_view", prsntf_read_only, 0, [ #must use prsntf_read_only or you cannot attack
(ti_on_presentation_load,
[
(presentation_set_duration, 999999),
(assign, ":view", 0),
(get_player_agent_no, ":player_agent"),
(agent_get_wielded_item, ":item_handone", ":player_agent", 0),
#(agent_get_wielded_item, ":item_handtwo", ":player_agent", 1),
(try_begin),
(eq, ":item_handone", -1),
(assign, ":view", 1), #use binoculars
(else_try),
#(ge, ":item_handone", 0),
(item_get_type, ":item_type_handone", ":item_handone"),
(try_begin),
(this_or_next|eq, ":item_type_handone", itp_type_one_handed_wpn),
(this_or_next|eq, ":item_type_handone", itp_type_two_handed_wpn),
(this_or_next|eq, ":item_type_handone", itp_type_bow),
(eq, ":item_type_handone", itp_type_polearm),
(assign, ":view", 2), #use binoculars
(else_try),
(eq, ":item_type_handone", itp_type_crossbow),
(assign, ":view", 2), #use scope
(else_try),
(eq, ":item_type_handone", itp_type_pistol),
(assign, ":view", 2), #use scope
(else_try),
(assign, ":view", 0), #pistol, other, don't do anything
(try_end),
(try_end),
(try_begin),
(eq, ":view", 1),
(create_mesh_overlay, reg1, "mesh_scope"),
(position_set_x, pos1, 0),
(position_set_y, pos1, 0),
(overlay_set_position, reg1, pos1),
(else_try),
(eq, ":view", 2),
(create_mesh_overlay, reg1, "mesh_scope"),
(position_set_x, pos1, 0),
(position_set_y, pos1, 0),
(overlay_set_position, reg1, pos1),
(try_end),
]),
(ti_on_presentation_run,
[
(neg|game_key_is_down,gk_zoom),
#(assign, "$zoom_view", 0),
(presentation_set_duration, 0),
]),
]),