Advertisement
RanggaBS

Global Variables

Jun 18th, 2022
1,138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.23 KB | None | 0 0
  1. --[[
  2.     Show all Bully's environment (Global Variables)
  3.  
  4.     This is for modding purpose only. Ignore this if you don't know.
  5.  
  6.     What this script do is to show all Bully's global variables.
  7.     Because Anniversary Edition & Scholarship Edition of Bully version has some variables that doesn't exist in other edition.
  8.  
  9.     Toggle UI:          [X] (SE), or zoom out (AE)
  10.     Navigation:
  11.         - Next:         [Right arrow] (SE), or jump button (AE)
  12.         - Previous:     [Left arrow] (SE), or weapon select button (AE)
  13.         Fast scroll:
  14.             - AE:       hold jump button & move analog up, down, left, or right
  15.             - SE:       hold left or right arrow
  16.    
  17.     Change display option to show key or value only:        zoom in (AE)
  18.  
  19. ]]
  20.  
  21. function main()
  22.     while not SystemIsReady() do
  23.         Wait(0)
  24.     end
  25.  
  26.     -- Localization:
  27.     local len = _G.table.getn
  28.     local str = _G.tostring
  29.  
  30.     -- Create & insert:
  31.     shared.GLOBAL_VAR = {s = 1, show = false, showKeyOnly = true}
  32.     for k, v in pairs(_G) do
  33.         shared.GLOBAL_VAR[len(shared.GLOBAL_VAR)+1] = {str(k), str(v)}
  34.     end
  35.  
  36.     -- Sort the table in ascending order:
  37.     table.sort(shared.GLOBAL_VAR, function(a, b)
  38.         return a[1] < b[1]
  39.     end)
  40.  
  41.     shared.ScholarshipEdition = type(_G["ClassMusicSetPlayers"]) == "function"  -- To detect whether the user playing on AE or SE version of Bully game.
  42.  
  43.     local scroll = GetTimer()
  44.     if not shared.ScholarshipEdition then
  45.         scroll = nil
  46.     end
  47.     local FastScroll
  48.     FastScroll = function(buttonId, controller)
  49.         if shared.ScholarshipEdition then
  50.             if IsButtonPressed(buttonId, controller) then
  51.                 if GetTimer() >= scroll+500 then
  52.                     return true
  53.                 end
  54.             end
  55.             if IsButtonBeingReleased(buttonId, controller) then
  56.                 scroll = GetTimer()
  57.             end
  58.             return false
  59.         else
  60.             if IsButtonHeld(8, 0) then
  61.                 if GetStickValue(16, 0) >= 0.5 or GetStickValue(17, 0) >= 0.5 then
  62.                     return "NavUp"
  63.                 elseif GetStickValue(16, 0) <= -0.5 or GetStickValue(17, 0) <= -0.5 then
  64.                     return "NavDwn"
  65.                 end
  66.                 --return true
  67.             end
  68.             return false
  69.         end
  70.         --return
  71.     end
  72.     local print
  73.     print = function(text, size)    -- size: 1(big); 2(small)
  74.         if shared.ScholarshipEdition then
  75.             TextPrintString(text, 0.1, size)
  76.         else
  77.             _G[size == 1 and "MinigameSetChapterCompletion" or "MinigameSetAnnouncement"](size == 1 and ''--[[yellow text]] or str(text), size == 1 and str(text) or true, size == 1 and true or nil, size == 1 and 0 or nil)
  78.         end
  79.     end
  80.  
  81.     -- testing:
  82.     --PlayerSetEnableFirstPerson(true)          -- nothing
  83.     --CameraSetSpeed(math.random(100))          -- nothing
  84.     --[[TextPrintString(GetLanguage(), 3, 1)    -- 0
  85.     Wait(3000)]]
  86.     --[[while not IsButtonBeingPressed(14, 0) do
  87.         Wait(0)
  88.         if IsButtonBeingPressed(3, 0) then
  89.             local fontStyle = math.random(50)
  90.             TextPrintString(fontStyle, 3, 1)
  91.             LoadFontStyle(fontStyle)
  92.         end
  93.     end]]
  94.  
  95.     while not (not (not (not (not (not (not (not (not (not true))))))))) do
  96.         Wait(0)
  97.         if IsButtonBeingPressed(shared.ScholarshipEdition and 14 or 3, 0) then
  98.             shared.GLOBAL_VAR.show = not shared.GLOBAL_VAR.show
  99.             if not shared.GLOBAL_VAR.show then
  100.                 print('', 1)
  101.                 print('', 2)
  102.                 MinigameReleaseCompletion()
  103.                 shared.GLOBAL_VAR.showKeyOnly = true
  104.             end
  105.         end
  106.         if shared.GLOBAL_VAR.show then
  107.             if IsButtonBeingPressed(shared.ScholarshipEdition and 0 or 8, 0) or FastScroll(0, 0) == true or FastScroll(nil, nil) == "NavUp" then
  108.                 shared.GLOBAL_VAR.s = shared.GLOBAL_VAR.s - 1
  109.                 if shared.GLOBAL_VAR.s < 1 then
  110.                     shared.GLOBAL_VAR.s = len(shared.GLOBAL_VAR)
  111.                 end
  112.             elseif IsButtonBeingPressed(shared.ScholarshipEdition and 1 or 11, 0) or FastScroll(1, 0) == true or FastScroll(nil, nil) == "NavDwn" then
  113.                 shared.GLOBAL_VAR.s = shared.GLOBAL_VAR.s + 1
  114.                 if shared.GLOBAL_VAR.s > len(shared.GLOBAL_VAR) then
  115.                     shared.GLOBAL_VAR.s = 1
  116.                 end
  117.             end
  118.             if shared.ScholarshipEdition then
  119.                 print("Key: " .. shared.GLOBAL_VAR[shared.GLOBAL_VAR.s][1] .. "\nValue: " .. shared.GLOBAL_VAR[shared.GLOBAL_VAR.s][2], 1)
  120.                 print(shared.GLOBAL_VAR.s, 2)
  121.             else
  122.                 if IsButtonBeingPressed(2, 0) then
  123.                     shared.GLOBAL_VAR.showKeyOnly = not shared.GLOBAL_VAR.showKeyOnly
  124.                 end
  125.                 print((shared.GLOBAL_VAR.showKeyOnly and shared.GLOBAL_VAR.s .. "\n" or '') .. shared.GLOBAL_VAR[shared.GLOBAL_VAR.s][shared.GLOBAL_VAR.showKeyOnly and 1 or 2], 2)
  126.             end
  127.         end
  128.     end
  129.  
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement