1
Modding Questions/Help / Re: How to use sigma in lua scripts
« on: December 23, 2021, 03:04:27 AM »
Why would you want to do that? You want the text to display in game? I don't think the default Bully fonts support that character.
News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..
Messages | Topics | Attachments
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.
Code: [Select]CreatePersistentEntity("ScoolBus")
CreatePersistentEntity("ScoolBus", x, y, z, rotationInDegrees, areacode)
The name of the props is just their name in World.img.the best place to look is in the Objects folder actually. Here is my list of spawnable entities from a menu I'm working on: https://pastebin.com/9mZEsmT8
--[[
--control scheme--
dpad up/down: scroll through letters
left/right weapon wheel: change case
dpad left: backspace
dpad right: next character
grapple: insert an underscore (_)
sprint: confirm text
]]
function main()
Wait(1000)
while true do
if IsButtonBeingPressed(3, 0) and not gTyping then
typing_typedStuff = F_OnScreenTyping("text: ") -- no args are necessary here, but you can optionally put a string of text here to display before the typing string
TextPrintString("typing finished", 2, 1)
elseif IsButtonBeingPressed(1, 0) and not gTyping and typing_typedStuff ~= nil then
TextPrintString("You typed: "..typing_typedStuff, 4, 1)
end
Wait(0)
end
end
typing_chars = {
{"a", "A"},
{"b", "B"},
{"c", "C"},
{"d", "D"},
{"e", "E"},
{"f", "F"},
{"g", "G"},
{"h", "H"},
{"i", "I"},
{"j", "J"},
{"k", "K"},
{"l", "L"},
{"m", "M"},
{"n", "N"},
{"o", "O"},
{"p", "P"},
{"q", "Q"},
{"r", "R"},
{"s", "S"},
{"t", "T"},
{"u", "U"},
{"v", "V"},
{"w", "W"},
{"r", "R"},
{"x", "X"},
{"y", "Y"},
{"z", "Z"},
{"1", "1"},
{"2", "2"},
{"3", "3"},
{"4", "4"},
{"5", "5"},
{"6", "6"},
{"7", "7"},
{"8", "8"},
{"9", "9"},
{"0", "0"},
}
typing_chars.n = table.getn(typing_chars)
gTyping = false
function F_OnScreenTyping(txt)
gTyping = true
typing_case = 1
typing_typed = {}
typing_typed.n = table.getn(typing_typed)
typing_index = 1
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_str = typing_typed[1]
PlayerWeaponHudLock(true) -- Optional, but I recommend this because the weapon wheel buttons will be used to change the letter case
repeat
F_PreventDPadUpFromZoomingIn()
-- Change case:
if IsButtonBeingPressed(11, 0) then
typing_case = 1
table.remove(typing_typed, typing_typed.n)
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
elseif IsButtonBeingPressed(13, 0) then
typing_case = 2
table.remove(typing_typed, typing_typed.n)
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
end
-- Select character:
if IsButtonBeingPressed(1, 0) then
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
elseif IsButtonBeingPressed(0, 0) and typing_typed.n > 1 then
table.remove(typing_typed, typing_typed.n)
typing_conc()
end
-- Change character:
if F_IsButtonBeingPressed(2, 0) then
typing_index = typing_index - 1
if typing_index < 1 then
typing_index = typing_chars.n
end
table.remove(typing_typed, typing_typed.n)
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
elseif F_IsButtonBeingPressed(3, 0) then
typing_index = typing_index + 1
if typing_index > typing_chars.n then
typing_index = 1
end
table.remove(typing_typed, typing_typed.n)
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
end
-- Insert an underscore:
if IsButtonBeingPressed(9, 0) then
table.insert(typing_typed, "_")
table.insert(typing_typed, typing_chars[typing_index][typing_case])
typing_conc()
end
-- Display text:
TextPrintString((txt and txt or "")..typing_str.."<", 1, 1)
Wait(0)
until IsButtonBeingPressed(7, 0)
gTyping = false
PlayerWeaponHudLock(false)
return typing_str
end
-- Concatenate strings from table:
function typing_conc()
typing_str = nil
for i = 1, typing_typed.n do
if typing_str == nil then
typing_str = typing_typed[1]
else
typing_str = typing_str..typing_typed[i]
end
end
end
function F_PreventDPadUpFromZoomingIn()
if IsButtonBeingReleased(2, 0) then
CameraAllowChange(false)
Wait(0)
CameraAllowChange(true)
end
end
gButtons = {}
function F_IsButtonBeingPressed(b, c)
if IsButtonBeingPressed(b, c) then
gButtons[b] = GetTimer()
return true
elseif IsButtonPressed(b, c) and gButtons[b] ~= nil then
return GetTimer() - gButtons[b] > 500
else
gButtons[b] = nil
return false
end
end
typedStuff = F_OnScreenTyping()
After this line, typedStuff will hold a string of whatever you typed.