Contents |
---|
About |
Module |
API |
Resources |
Contact Me |
About
The ContextActionUtility is a replacement module for Roblox’s ContextActionService. Its main purpose is for easy, intuitive mobile support. It works interchangeably with Roblox’s ContextActionService.
𝙋𝙧𝙤-𝘾𝙤𝙣 𝘾𝙝𝙖𝙧𝙩
Pros |
---|
Automatic button positioning |
Works on every device |
Intuitive and simple |
Customizable |
Made by @PseudoPerson |
Cons |
---|
Button positioning in-game is limited |
All buttons are relative to the jump button |
Edge cases are untested |
Made by @PseudoPerson |
𝙁𝙚𝙖𝙩𝙪𝙧𝙚𝙨 𝙖𝙣𝙙 𝙋𝙞𝙘𝙩𝙪𝙧𝙚𝙨
The Example Game has all of these examples and the module in it. Only the color example and cross-platform compatibility example are enabled on the public game. To see the others, grab a copy for yourself and enable them in studio.
Cross Platform Compatablity
Automatic Positioning Example
Feature Summary
-
Priority-based Automatic Positioning:
- Buttons automatically fill “slots” in a predetermined order.
- Slots can be “hogged” by using
BindAction()
to bind and empty function and removing the image. - This automatic positioning system is great for games with lots of actions that aren’t always needed.
-
Automatic Creation of Matching Buttons:
- Buttons are created automatically relative to the jump button. Customizing buttons is easy with
SetTitle()
,SetImage()
,SetPressedColor()
, andSetReleasedColor()
. Additional customization can be done withGetButton()
. - Unlike the current ContextActionService default buttons, ContextActionUtility buttons match the mobile controls.
- Buttons are created automatically relative to the jump button. Customizing buttons is easy with
-
Works Seamlessly with ContextActionService Code:
- Works with code for the ContextActionService.
- Adding mobile support only requires coding visual customizations.
Open Source Example Game
Module
v.0 Model
𝙎𝙤𝙪𝙧𝙘𝙚 𝘾𝙤𝙙𝙚
API
𝙋𝙧𝙤𝙥𝙚𝙧𝙩𝙞𝙚𝙨
bool
Archivable
string
ClassName
string
Name
Instance
Parent
𝙁𝙪𝙣𝙘𝙩𝙞𝙤𝙣𝙨
BindAction(
string
actionName,Function
functionToBind,bool
createTouchButton,Tuple
inputTypes)
BindActionAtPriority(
string
actionName,Function
functionToBind,bool
createTouchButton,int
priorityLevel,Tuple
inputTypes)
UnbindAction(
string
actionName)
DisableAction(
string
actionName)
SetTitle(
string
actionName,string
title)
SetImage(
string
actionName,string
image)
SetPressedColor(
string
actionName,Color3
color)Sets the color the button is set to when it is pressed.
SetReleasedColor(
string
actionName,Color3
color)Sets the color the button is set to when it is released.
GetButton(
string
actionName)
MakeButtonRound(
string
actionName,number
amount)Uses a UICorner to make the button’s shape and interaction box rounded. Amount is the degree of the rounding. Amount 0.5 is completely round. Amount 0 is completely square.
MakeButtonSquare(
string
actionName)Makes the button and its interaction box square.
𝙀𝙫𝙚𝙣𝙩𝙨
LocalToolEquipped(
Instance
toolEquipped)
LocalToolUnequipped(
Instance
toolUnequipped)
Resources
𝘽𝙪𝙩𝙩𝙤𝙣𝙨
Note: Set to Transparency to 0.5 (ContextActionUtility does this automatically)
Note: Asset URLs are in the ContextActionUtility’s comments
Asset URL: rbxassetid://5713982324
Decal URL: Default Button - Roblox
Asset URL: rbxassetid://5754149564
Decal URL: ! Button - Roblox
Asset URL: rbxassetid://5754150372
Decal URL: ? Button - Roblox
Asset URL: rbxassetid://5754151192
Decal URL: ... Button - Roblox
Asset URL: rbxassetid://5754151652
Decal URL: https://www.roblox.com/catalog/5754151685/Cancel-Button
Asset URL: rbxassetid://5754152113
Decal URL: https://www.roblox.com/catalog/5754152138/Minus-Button
Asset URL: rbxassetid://5754152510
Decal URL: https://www.roblox.com/catalog/5754152529/Plus-Button
Asset URL: rbxassetid://5754152998
Decal URL: https://www.roblox.com/catalog/5754153018/Speech-Button
Asset URL: rbxassetid://5754153324
Decal URL: https://www.roblox.com/catalog/5754153337/Star-Button
Asset URL: rbxassetid://5754154247
Decal URL: https://www.roblox.com/catalog/5754154271/Sword-Button
Asset URL: rbxassetid://5743592925
Decal URL: Read Button - Roblox
Asset URL: rbxassetid://5743593320
Decal URL: Attack Button - Roblox
Asset URL: rbxassetid://5743593654
Decal URL: Target Button - Roblox
Asset URL: rbxassetid://5743594013
Decal URL: Hamburger Button - Roblox
Vector Images
𝙀𝙭𝙖𝙢𝙥𝙡𝙚
Contact Me
Hello all! If you find anything you want me to change in this article or in the module please contact me through discord, dev forums dm, or the comment section. It really helps to have other people proof read my code and is greatly appreciated! Thanks for reading everyone!
- PseudoPerson
ᴄᴏɴᴛᴀᴄᴛ ᴍᴇ ᴛʜʀᴏᴜɢʜ:
Discord: PseudoPerson#3347
Roblox: Roblox Profile
Dev Forums: Developer Forum Profile