Just store and reset the inv window's .TopItem:
https://adventuregamestudio.github.io/ags-manual/InvWindow.html#invwindowtopitem
https://adventuregamestudio.github.io/ags-manual/InvWindow.html#invwindowtopitem
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menufunction Room_RepExec() {
...
}
function on_call(int param) {
if (param == 1) Room_RepExec();
}
// elsewhere
CallRoomScript(1);
bool wasOverActiveArea;
void HandleCursor() {
if (Mouse.Mode == eModeUseinv) return; // do nothing
bool isOverActiveArea = GetLocationType(mouse.x, mouse.y) != eLocationNothing; // compare to enum!
if (isOverActiveArea && !wasOverActiveArea) {
// mouse just moved over active area
Mouse.UseModeGraphic(eModePointer); // pointer for both
}
else if (!isOverActiveArea && wasOverActiveArea) {
// mouse just left active area
if (player == cWoman) Mouse.UseModeGraphic(eModeDapHandU);
else Mouse.UseDefaultGraphic();
}
}
function repeatedly_execute() {
HandleCursor();
// other stuff
}
function SwitchToWoman() {
Mouse.ChangeModeGraphic(eModeInteract, 123); // sprite slot 123 is woman's interact cursor
Mouse.ChangeModeGraphic(eModeTalkto, 124)); // sprite slot 124 is woman's interact cursor
cWoman.SetAsPlayer();
}
#define ROWS 4 // four houses
#define COLS 4 // color, name, country, article
#define CELLCOUNT 16 // ROWS * COLS
int cellValue[CELLCOUNT]; // one integer for each cell: -1 is empty, 0 = first option, 1 = second option, etc.
String options[CELLCOUNT]; // # of total options == # of cells
// table's room coordinates
int offsetX = 40, offsetY = 60; // coordinates of the top left corner of the first clickable cell
int cellWidth = 70, cellHeight = 20; // cell size
// sprite to store room background
DynamicSprite* backup;
function room_Load() {
options[0] = "yellow";
options[1] = "red";
options[2] = "green";
options[3] = "blue";
options[4] = "John";
// ...
options[8] = "USA";
options[9] = "Spain";
// ...
options[12] = "magazines";
options[13] = "newspapers";
for (int i = 0; i < CELLCOUNT; i++) cellValue[i] = -1;
backup = DynamicSprite.CreateFromBackground();
}
function hTable_AnyClick(Hotspot* theHotspot, MouseButton button) {
// calculate clicked row and column from mouse coordinates
int col = (mouse.x + Screen.Viewport.X - offsetX) / cellWidth;
int row = (mouse.y + Screen.Viewport.Y - offsetY) / cellHeight;
// change cell value
int i = row * COLS + col; // array index
cellValue[i]++; // move to next option
if (cellValue[i] == ROWS) cellValue[i] = -1; // if cell contained last option, set to empty
UpdateCells();
}
void UpdateCells() {
DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
ds.DrawImage(0, 0, backup.Graphic); // restore room bg (i.e. empty table)
// cell contents
ds.DrawingColor = Game.GetColorFromRGB(123, 45, 74); // font color
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLS; col++) {
int i = row * COLS + col; // array index
if (cellValue[i] > -1) {
String text = options[col * ROWS + cellValue[i]];
int x = col * cellWidth + offsetX + 2; // some padding
int y = row * cellHeight + offsetY + (cellHeight - GetFontHeight(eFontFont0)) / 2;
ds.DrawStringWrapped(x, y, cellWidth, eFontFont1, eAlignCenter, text);
}
}
}
ds.Release();
}
game.dialog_options_highlight_color = Game.GetColorFromRGB(255, 255, 0); // bright yellow
import cryptoRandomString from 'crypto-random-string';
export default function uniqueString() {
return cryptoRandomString({length: 32});
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 3.877 seconds with 15 queries.