-
-
Notifications
You must be signed in to change notification settings - Fork 8
Useful Things
Nenkai edited this page Sep 21, 2025
·
8 revisions
The Adhoc API can be very helpful. It's mostly intended for GT5/6 & above but some few things may apply to GT4.
context.addTimeOut("myFunctionTimeout", (context) =>
{
// ...
}, context);
context.setTimeOut("myFunctionTimeout", 0.5); // Will be called in 0.5s<module>.load("path_to_script"); // no .adc extensionmain::sound.play(sfx_name); // i.e "cursor"You can stop or enable input events (like onKeyPress, etc) by using MRenderContext.event_mask:
context.event_mask &= ~0x01; // Untoggles bit 0 which is pad 1 (player 1)
context.event_mask |= 0x02; // Toggles bit 1 which is pad 2 (player 2)
context.event_mask |= 0x04; // Toggles bit 2 for keyboard events
context.event_mask |= 0x10; // Toggles bit 4 for mouse events (MMotionEvent)You can also use MRenderContext.disableInput/MRenderContext.enableInput
MRenderContext.filterKeyEvent is helpful to flush current events if any.
DialogUtil::openConfirmDialog(context, DialogUtil::..., message);CursorUtil::setCursor(context, cursor_name);// GT4/5
// Get the specified string at specified category & key
context.translate(category, key);
// Page & category are combined i.e MyRoot::MyCategory)
context.translate(page, category, mode);manager.translate(category, key);for (var it = <widget>.first; it != nil; it = it.next_widget)
{
// ...
}<module>.setFocus(widget); // example: ROOT.setFocus(my_widget);context.wait(seconds_float) // example: 0.5