- 37
- Posts
- 20
- Years
- Age 34
- New York
- Seen Jul 28, 2018
Getting straight to the point, I want to create a scrolling list where the player can choose an option: similar to if you use the Debug window in a playtest, and you go to say, "Add Item"(the additional sprites not included, of course).
I found two functions already in Essentials that I may be able to use: pbListWindow and pbListScreenBlock.
...but I'm new to Ruby, and even in C++ I was so bad at programming. I'm not sure how to use these, beyond the fact that I'd have to make an entire class for pbListScreenBlock. Can anyone help me in my endeavors?
I found two functions already in Essentials that I may be able to use: pbListWindow and pbListScreenBlock.
Code:
def pbListWindow(cmds,width=256)
list=Window_CommandPokemon.newWithSize(cmds,0,0,width,Graphics.height)
list.index=0
list.rowHeight=24
pbSetSmallFont(list.contents)
list.refresh
return list
end
Code:
def pbListScreenBlock(title,lister)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
list=pbListWindow([],256)
list.viewport=viewport
list.z=2
title=Window_UnformattedTextPokemon.new(title)
title.x=256
title.y=0
title.width=Graphics.width-256
title.height=64
title.viewport=viewport
title.z=2
lister.setViewport(viewport)
selectedmap=-1
commands=lister.commands
selindex=lister.startIndex
if commands.length==0
value=lister.value(-1)
lister.dispose
return value
end
list.commands=commands
list.index=selindex
loop do
Graphics.update
Input.update
list.update
if list.index!=selectedmap
lister.refresh(list.index)
selectedmap=list.index
end
if Input.trigger?(Input::A)
yield(Input::A, lister.value(selectedmap))
list.commands=lister.commands
if list.index==list.commands.length
list.index=list.commands.length
end
lister.refresh(list.index)
elsif Input.trigger?(Input::C) || (list.doubleclick? rescue false)
yield(Input::C, lister.value(selectedmap))
list.commands=lister.commands
if list.index==list.commands.length
list.index=list.commands.length
end
lister.refresh(list.index)
elsif Input.trigger?(Input::B)
break
end
end
lister.dispose
title.dispose
list.dispose
Input.update
end
...but I'm new to Ruby, and even in C++ I was so bad at programming. I'm not sure how to use these, beyond the fact that I'd have to make an entire class for pbListScreenBlock. Can anyone help me in my endeavors?