Fallout 2 mod Command to find Tile # under Mouse Cursor?

QuantumApprentice

Where'd That 6th Toe Come From?
I've looked around the wiki, checked the scripting command list, and did a search of the forum but I'm not really finding anything that specifically returns the value of the tile under the mouse cursor when you click on it. I feel like I might be missing something though, since this is probably the most used part of the game.

Is it something obvious and I'm just blind?
 
I've looked around the wiki, checked the scripting command list, and did a search of the forum but I'm not really finding anything that specifically returns the value of the tile under the mouse cursor when you click on it. I feel like I might be missing something though, since this is probably the most used part of the game.
Is it something obvious and I'm just blind?
Use MOUSECLICK hook and the combination of sfall script functions:
Code:
tileNum := tile_by_position(get_mouse_x, get_mouse_y);
 
Use MOUSECLICK hook and the combination of sfall script functions:
Code:
tileNum := tile_by_position(get_mouse_x, get_mouse_y);
Hmm....that's weird I can't quite get these commands recognized.
I have sfall.h included from modderspack 4.2.8.1, but I'm not getting tileNum,
tile_by_position, or (get_mouse_x, get_mouse_y) to work in my script..

Any clue what I did wrong?

This one is recognized but I may be using it incorrectly.
Any tips?

My current script:
Code:
/*******************************************************************************
        Name:     
        Location: Quantum's Map
        Description: Object template script

            Created: by sFall Script Editor
            Updated: 12/16/2020

*******************************************************************************/

/* Include Files */
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "..\headers\sfall.h"
#include "..\headers\define_extra.h"
#include "..\headers\define_lite.h"

/* Standard Script Procedures */
procedure start;
procedure description_p_proc;
procedure look_at_p_proc;
procedure damage_p_proc;
procedure use_p_proc;
procedure use_obj_on_p_proc;
procedure use_skill_on_p_proc;
procedure drop_p_proc;
procedure is_dropping_p_proc;
procedure pickup_p_proc;

/* Defines */
#define tileNum


procedure use_obj_on_p_proc begin

//#define tileNum;
//tileNum := tile_by_position(get_mouse_x, get_mouse_y);
float_msg (self_obj, tile_under_cursor, FLOAT_COLOR_AFRAID);


end
 
So you are using an object and then you want to know the position of that object?
Code:
tile_num(self_obj)


Also #define tileNum is wrong. Variables start with "variable".
Code:
variable tileNum;

You should look at vanilla scripts again.
 
So you are using an object and then you want to know the position of that object?
Code:
tile_num(self_obj)
Nah, I worked with the object addressing before, I'm trying to find out the tile number under the cursor, sort of like when you move in the game from one hex to the next after clicking on it.
I'm not really finding anything that specifically returns the value of the tile under the mouse cursor when you click on it.

Also #define tileNum is wrong. Variables start with "variable".
Code:
variable tileNum;
You should look at vanilla scripts again.
Ah thanks for explaining :)
 
Ok I spent the day perusing scripts to figure out how to get my idea to work, but I think I may need some help finding representative scripts to understand how to use sfall scripts.
Can anybody suggest a script example or mod that makes use of sfall hooks?

I've been looking at the Party Orders addon source script to see how he constructs them, but I don't think they ever used mouse click hooks. Any other good sources?
 
FO2tweaks also makes extensive use of hooks.
It'd be easier if you explained what exactly you're trying to achieve.
 
FO2tweaks also makes extensive use of hooks.
It'd be easier if you explained what exactly you're trying to achieve.
I'm trying to make "jump jets"...something that (by clicking and "using" it from item slot like a doctors bag or something) allows the player to "jump" directly to a hex a reasonable distance away, but only using a couple of AP.
 
I use a debug script for jumping)
Code:
procedure start begin
   if game_loaded then begin
         register_hook(HOOK_KEYPRESS);
   end
   else begin

//        int     arg1 - event type: 1 - pressed, 0 - released
//        int     arg2 - key DX scancode
//        int     arg3 - key VK code (very similar to ASCII codes)

      variable type := get_sfall_arg, keyDX := get_sfall_arg;

      // код для отладки: Pressed LeftMouse + Click LeftALT  - переместить игрока на гекс под курсором.
      if keyDX == DIK_LALT and get_game_mode == 0 and get_mouse_buttons == 1 and type == 0 then begin
          move_to(dude_obj, tile_under_cursor, dude_elevation);
          reg_anim_clear(dude_obj);
      end
      if keyDX == DIK_RALT and get_game_mode == 0 and get_mouse_buttons == 1 and type == 0 then begin
          if dude_elevation >= 2 then global_temp := -2; else global_temp := 1;
          move_to(dude_obj, tile_under_cursor, dude_elevation + global_temp);
          reg_anim_clear(dude_obj);
      end

   end
end
 
Back
Top