RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Ring Menu (Almost Done !)

0 Members and 1 Guest are viewing this topic.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
To prove I'm not completely rusty when it comes to scripting I decided to write a Ring Menu script.

Yes, much like the ones that have come before it. However! There is a difference.
Since I do not currently understand the math used in the other Ring Menus, I have decided to use my own ideas to produce the same results.

The whole thing is based off of the equation of a circle of course.

If (h,k) is the origin and (x,y) is a point that lies on the circle, then : (x-h)^2 + (y-k)^2 == radius^2.

I have finished the bulk of it tonight and should be able to do the calculations by the end of next week.
I have no means of testing it, so when I finish the script it would be wonderful if someone would test it for me.

To all scripters who read this topic : I apologize if this is not as optimized as it could be. If it has to do with the math I do then it is something people will have to live with. Half the point of writing this script is to see if I can do it this way.

Spoiler for Ring_Menu {INCOMPLETE}:
Code: [Select]
class Window_Ring_Command < Window_Command
def initialize(x,y,width, commands)
super(x, y, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
@column_max = @item_max
self.contents = Bitmap.new(width - 32, 32)
refresh
self.index = 0
end
def refresh
self.contents.clear
draw_item(@index, normal_color)
end
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4,32,self.contents.width - 8,32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index],1)
end
def update_cursor_rect(cursor = false)
if cursor
cursor_width = self.width - 32
self.cursor_rect.set(0,0,cursor_width,32)
else
self.cursor_rect.empty
end
end
def update
if @old_index != nil and @old_index != @index
refresh
end
super
@old_index = @index.clone
end
def set_opacity(opacity)
self.opacity = opacity
self.back_opacity = opacity
end
end
class Ring_Menu
def initialize(x,y,radius,commands = [],icons = [],origin = true)
# Retrive important values and initalize icon array
@x = x*1.0
@y = y*1.0
@radius = radius*1.0
@diameter = @radius * 2
@commands = commands
@icon_names = icons
@icon_sprites = []
# If origin is true, then (x,y) = (h,k)
# If origin is false, then (x,y) are the x and y of the whole ring menu
@origin = origin
# Retrive alternate opacity if provided
if yield != nil
@opacity = yield
else
@opacity = 0
end
# Find all of the points on the circle
if @origin
# Find all of the points on the circle
a1 = @x - radius
b1 = @y - radius
a2 = @x + radius
b2 = @y + radius
else
a1 = @x
b1 = @y
a2 = @x + @diameter
b2 = @y + @diameter
end
a_range = a2 - a1
b_range = b2 - b1
temp_points = []
for i in 0..a_range
for j in 0..b_range
temp_points.push[a1+i,b1+j]
end
end
@points_on_circle = []
if @origin
temp_points.each do(|n|
if (n[0]-@x)**2+(n[1]-@y)**2 == @radius**2
@points_on_circle.push(n)
end)
else
temp_points.each do(|n|
if (n[0]-(@x+@radius))**2+(n[1]-(@y+@radius))**2 == @radius**2
@points_on_circle.push(n)
end)
end
# Create command window to display option text
@command_window = Window_Ring_Command.new(a1,b2+1,@diameter,@commands)
@command_window.set_opacity(@opacity)
# Create icons for ring menu
for i in 0..@icon_names.size
@icon_sprites.push(Sprite.new)
@icon_sprites[i].bitmap =  RPG::Cache.icon(@icon_names[i])
# <^> Instructions to retrive appropriate initial x and y coordinates <^>
@icon_sprites[i].x = icon_x
@icon_sprites[i].y = icon_y
end
end
def move_icons
# <^>Instructions for moving sprites <^>
end
def update
# Move the icons if the index has changed
if @old_index != nil and @old_index != @index
move_icons
end
# Update the command window and store the current index
@command_window.update
@old_index = @command_window.index.clone
end
end

P.S. From now on, if I post a script that is tested and works, I will place this image at the beginning of the thread -

This is something I drew a long time ago about 2 in the morning, and I thought it would be cute.

EDIT: I hope nobody caught that embarassing error that was in the portion of the code completed. I can't call myself a scripter if I let something like that go unchecked.
« Last Edit: December 08, 2007, 11:09:42 PM by Tsunokiette »
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
Rep:
Level 102
2014 Biggest Narcissist Award2014 Biggest Forum Potato2014 Best Non-RM Creator2013 Best Game Creator (Non-RM)2013 Best IRC ChatterboxParticipant - GIAW 112012 Most Successful Troll2012 Funniest Member2012 Best Use Of Avatar and Signature space2012 Best IRC ChatterboxSecret Santa 2012 ParticipantProject of the Month winner for November 2009For being a noted contributor to the RMRK Wiki2010 Most Successful Troll2010 Biggest Forum Couch Potato2010 Best IRC Chatterbox
Is any part of it usable? Or is it just incomplete code?

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Is any part of it usable? Or is it just incomplete code?

Anything in life is usable, even that which is incomplete.

If you're asking if this is a complete script, then no.

But if you have an abstract mind and can see what I'm going to do, and do it before I do, then by all means do it.

:)

EDIT : I would have thought the {INCOMPLETE} would have been a hint...
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
Rep:
Level 102
2014 Biggest Narcissist Award2014 Biggest Forum Potato2014 Best Non-RM Creator2013 Best Game Creator (Non-RM)2013 Best IRC ChatterboxParticipant - GIAW 112012 Most Successful Troll2012 Funniest Member2012 Best Use Of Avatar and Signature space2012 Best IRC ChatterboxSecret Santa 2012 ParticipantProject of the Month winner for November 2009For being a noted contributor to the RMRK Wiki2010 Most Successful Troll2010 Biggest Forum Couch Potato2010 Best IRC Chatterbox
Is any part of it usable? Or is it just incomplete code?

Anything in life is usable, even that which is incomplete.

If you're asking if this is a complete script, then no.

But if you have an abstract mind and can see what I'm going to do, and do it before I do, then by all means do it.

:)

EDIT : I would have thought the {INCOMPLETE} would have been a hint...
I was just wondering if it would work, like you were releasing it as beta or something. ^_^

I would complete it, but the only thing in RGSS I know is "true" and "false."