Hello
I am working on a function to create a menu window that can be scrolled through using the mouse wheel. Its not a full function yet but here is the code. I am going to make some adjustments to make it more universal but I thought someone might find this useful. Let me know if you do
sync on
global pointz as float
type list
name as string
hotlink as integer
description as string
endtype
dim spells(-1) as list
make_list("spells.txt")
list_point=0
do
cls
start=mousez()/120
if start<0 then start=0
if start+10>=array count(spells()) then start=array count(spells())-10
final_width =0
for a = 0 to array count(spells())
if text width(spells(a).name)>final_width then final_width=text width(spells(a).name)
next a
ink rgb(0,0,255),0
box 0,0,final_width+20,(text height("test")*10)+20
for a = start to start+9
if mousey()>=text height("test")*(a-start)+10 and mousey()<text height("test")*(a-start+1)+10 and mousex()>10 and mousex()<=10+text width(spells(a).name)+10
ink rgb(255,0,0),0
else
ink rgb(255,255,255),0
endif
text 10,10+(text height(spells(a).name)*(a-start)),spells(a).name
next a
sync
loop
function make_list(file$)
open to read 1,file$
repeat
array insert at bottom spells()
read string 1,a$
spells(array count(spells())).name=a$
until file end(1)=1
close file 1
endfunction
You can copy this to a text file and name it spells.txt or whatever
---Abjurations---
Alarm
Endure Elements
Hold Portal
Protection from Chaos
Protection From Good
Protection From Evil
Protection From Law
Shield
---Conjurations---
Grease
Mage Armor
Mount
Obscuring Mist
Summon Monster I
Unseen Servant
---Divinations---
Comprehend Languages
Detect Secret Doors
Detect Undead
Identify
True Strike
---Enchantments---
Charm Person
Hypnotism
Sleep
---Evocations---
Magic Missile
Tenser's Floating Disk
---Illusions---
Change Self
Color Spray
Nystul's Magic Aura
Nystul's Undetectable Aura
Silent Image
Ventriloquism
---Necromancy---
Cause Fear
Chill Touch
Ray of Enfeeblement
---Transmutations---
Animate Rope
Burning Hands
Enlarge
Erase
Expeditious Retreat
Feather Fall
Jump
Magic Weapon
Message
Reduce
Shocking Grasp
Spider Climb
Its just a list I was using to test the code