Main Menu
  • Welcome to The RPG Maker Resource Kit.

Cursor Command

Started by Tsunokiette, January 07, 2006, 09:01:59 PM

0 Members and 2 Guests are viewing this topic.

Tsunokiette

This will allow you to create a Command Window that uses a cursor (or pointer whatever you want to call it) instead of a selector around the text. Of course you can also create a normal menu using this as well.

First of all, import this into the icons folder. (make the background transparent...)



Then place this with all the other Window Scripts

# ==============================
# * Cursor Command *           
# ------------------------------
# Version 1               
# 01.07.06                 
# ------------------------------
# Tsunokiette (Give credit)
# ==============================
class Cursor_Command < Window_Base

def initialize(width, commands, pointer = false)
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
@pointer = pointer
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end

def refresh(index = 0)
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
if @pointer == true
draw_pointer(index)
end
end

def draw_pointer(index)
rect2 = Rect.new(0, 32 * index + 4, 24, 24)
self.contents.fill_rect(rect2, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon('hand')
self.contents.blt(0, 0, bitmap, rect2)
end

def draw_item(index, color)
self.contents.font.color = color
if @pointer == true
rect1 = Rect.new(24, 32 * index, self.contents.width - 24, 32)
self.contents.fill_rect(rect1, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect1, @commands[index],1)
else
rect1 = Rect.new(0, 32 * index, self.contents.width, 32)
self.contents.fill_rect(rect1, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect1, @commands[index],1)
end
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect
if @index < 0 or @pointer == true
self.cursor_rect.empty
return
end
x = 0
y = 32 * @index
cursor_width = self.contents.width
self.cursor_rect.set(x, y, cursor_width, 32)
end

alias :original_update :update
def update
if @pointer == true
refresh(@index)
end
original_update
end

end


To create a nomal menu do this-

@menu = Cursor_Command.new(width,[commands])

To create a menu using the pointer (cursor) do this-

@menu = Cursor_Command.new(width,[commands],true)

If you get an error tell me immediately, it's a simple script so if it has any errors, it shouldn't be too hard to fix
"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."

Ramiro

Cool thing Tsukionette!!! That

darklinkn2it

Quote@menu = Cursor_Command.new(width,[commands],true)

where do I add this?
Not Dead...only sleeping...unlucky...

-qoute from fable on tombstone

Atracious

Quote from: Tsunokiette on January 07, 2006, 09:01:59 PM
This will allow you to create a Command Window that uses a cursor (or pointer whatever you want to call it) instead of a selector around the text. Of course you can also create a normal menu using this as well.
is there a way to make there be no cursor? just get rid of the stupid box for some menus.....?
"Facts are useless. You could use facts to prove anything that's even remotely true." Homer Jay Simpson

"I do not know what weapons WWIII will be fought with but i know WWIV will be fought with sticks and stones" Albert Einstein

"It's better to have loved and lost than never to have loved at all." from In Memoriam, by Alfred, Lord Tennyson.

"all your base are belonging to us!" awful fantasy 3

"the grapes damb it, it's alway's the grapes!"

Funny anagrams:
Desperation=A rope ends it
Mother in law=Woman hitler
Lottery machine=Money lost in 'em
Election results=Lies lets recount
Dormitory=Dirty room
Snooze alarms=Alas! No more Z's
Eleven plus two=Twelve plus one
Cosmetic surgery="Yes, I correct mugs."
The IRS=Theirs!
Public relations=Crap, built on lies
Astronomer=Moon starer
Dementia="Detain me."
Internet chat rooms=The moron interacts
The eyes!=They see!

Currently making:
http://rmrk.net/index.php/topic,13132.0.html

Tsunokiette

I'm not sure what you mean. Do you mean the default cursor? (The selection box that highlights the options)

It's like a 5 second edit, but why would you want to do that? You need to have some sort of indication that the option is selected.

If you're talking about getting rid of it when the pointer (or whatever) is being used, that already happens.
"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."

Atracious

Quote from: Tsunokiette on March 07, 2008, 04:53:42 PM
I'm not sure what you mean. Do you mean the default cursor? (The selection box that highlights the options)

It's like a 5 second edit, but why would you want to do that? You need to have some sort of indication that the option is selected.
Yes i want to get rid of the selection box, i will have a way of showing what is selected, but the window has a special set-up, which makes the selection boxes not line up properly, so i would like to get rid of them entirely.
"Facts are useless. You could use facts to prove anything that's even remotely true." Homer Jay Simpson

"I do not know what weapons WWIII will be fought with but i know WWIV will be fought with sticks and stones" Albert Einstein

"It's better to have loved and lost than never to have loved at all." from In Memoriam, by Alfred, Lord Tennyson.

"all your base are belonging to us!" awful fantasy 3

"the grapes damb it, it's alway's the grapes!"

Funny anagrams:
Desperation=A rope ends it
Mother in law=Woman hitler
Lottery machine=Money lost in 'em
Election results=Lies lets recount
Dormitory=Dirty room
Snooze alarms=Alas! No more Z's
Eleven plus two=Twelve plus one
Cosmetic surgery="Yes, I correct mugs."
The IRS=Theirs!
Public relations=Crap, built on lies
Astronomer=Moon starer
Dementia="Detain me."
Internet chat rooms=The moron interacts
The eyes!=They see!

Currently making:
http://rmrk.net/index.php/topic,13132.0.html

Tsunokiette

Quote from: atracious on March 07, 2008, 10:30:57 PM
Yes i want to get rid of the selection box, i will have a way of showing what is selected, but the window has a special set-up, which makes the selection boxes not line up properly, so i would like to get rid of them entirely.

M'kay.

Just add this into your window code -

def update_cursor_rect
self.cursor_rect.empty
end
"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."

Atracious

thanks that did the trick! :)
"Facts are useless. You could use facts to prove anything that's even remotely true." Homer Jay Simpson

"I do not know what weapons WWIII will be fought with but i know WWIV will be fought with sticks and stones" Albert Einstein

"It's better to have loved and lost than never to have loved at all." from In Memoriam, by Alfred, Lord Tennyson.

"all your base are belonging to us!" awful fantasy 3

"the grapes damb it, it's alway's the grapes!"

Funny anagrams:
Desperation=A rope ends it
Mother in law=Woman hitler
Lottery machine=Money lost in 'em
Election results=Lies lets recount
Dormitory=Dirty room
Snooze alarms=Alas! No more Z's
Eleven plus two=Twelve plus one
Cosmetic surgery="Yes, I correct mugs."
The IRS=Theirs!
Public relations=Crap, built on lies
Astronomer=Moon starer
Dementia="Detain me."
Internet chat rooms=The moron interacts
The eyes!=They see!

Currently making:
http://rmrk.net/index.php/topic,13132.0.html

vath

#8

;9 i put the "window_script" above "main"
and, where to put  this command ?
@menu = Cursor_Command.new(width,[commands],true)[

Tsunokiette

Quote from: vath on March 12, 2008, 02:59:12 PM

;9 i put the "window_script" above "main"
and, where to put  this command ?
@menu = Cursor_Command.new(width,[commands],true)[

My post got screwed somehow. Anyways, find line 35 and delete the second ")" that's there. It shouldn't be there.

And you put

@menu = Cursor_Command.new(width,[commands],true)

In the same place you would put a normal command window. In fact you should be able to just change the first part to Cursor_Command.new and add ",true" to the end.
"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."

royalgia

Sory but i can't see the demo, who can help me please ?? upload it to mediafire.com for me, thousand thanks  :lol: