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.
[VXA] Hover Alerts

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 89
I ran into an error when trying to create a hover alert during a common event when drawing a variable in the 'name'

This is what I wrote in the comment:
\hover_alert[-1] { name = "+ #{$game_variables[18]}QP";
icon = 8673; effect = :rise_and_fade; }

This is the error I'm getting:

Script 'MAHoverAlers' line 286: SyntaxError occurred.

unexpected $end, expecting '}'
name = "+ #{$game_variables[18]

pokeball YinOfflineFemale
**
Rep:
Level 86
If you do compatibility fixes, I seem to have found one when using galv's region effects. When you have a hover alert over the player and walk over a region effected by the script, the hover alert constantly update for every tile walked on until you get off of a region effect tile.

My specific error is: I get an item (Auto gain hover alert) and as I'm walking away and enter a region effect tile, the alert keeps displaying over and over again until I stop walking or until I get off of the region effect terrain.

**
Rep: +0/-0Level 55
Waiting ...
found an issue - or maybe I am doing it wrong. I set up a parallel event to make sure that the hove appears over event 2, it appears over its self instead. see demo

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Sorry for the delay in responding. I've been away. If any of you still need help:

@Mewgull - It's because of the "#{$game_variables[18]}". The } is messing it up. I should have predicted that and fixed it, but you can do the same thing with:

name = "+ " + $game_variables[18].to_s + "QP";

@Yin - Can you recreate the error in a demo and share it with me?

@Kalacious - You can only set it to another event by that means with an interpreted code, not an automatic one at the top of the page.

pokeball YinOfflineFemale
**
Rep:
Level 86
Sure, here you go:
http://www.sendspace.com/file/ddblgc

Just get the glowy object and walk on the regions. The alert will keep repeating itself until you stop walking and let it finish. (Those are also MY default settings. I have not tried it with the default settings of the script.)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Everytime you walk on an event-generating region, galv's script disposes every character sprite and recreates it. This causes the error you detected since the hover sprite is dependent on the existence of the character to whom it is attached; when the character is disposed, so is the hover sprite.

To fix it, I needed to change that mass disposal feature of galv's script and replace it with one that only recreates the character in issue, but I am not entirely sure how that will interact with other scripts or whether it might cause problems down the line. On the plus side, however, it is less resource-intensive and will probably cause less lag in maps with many events.

Anyway, here is the patch:

Code: [Select]
#==============================================================================
#    Hover Alerts + galv's Region Effects
#    Compatibility Patch
#    Version: 1.0
#    Authors: modern algebra (rmrk.net) & galv
#    Date: 5 October 2013
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This patch fixes an error between my Hover Alerts script and galv's Region
#   Effects script. Without it, a hover alert will constantly refresh when
#   walking through an event-generating region.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Insert this script into the Script Editor (F11) in a new slot, somewhere
#   below galv's Region Effects script but still above Main.
#==============================================================================

#==============================================================================
# ** Spriteset_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - gre_refresh_event
#==============================================================================

class Spriteset_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def gre_refresh_event(id)
    # Find any existing event with the same ID
    esi = @character_sprites.find_index {|sprite| sprite &&
      sprite.is_a?(Sprite_Character) && sprite.character.is_a?(Game_Event) &&
      sprite.character.gre_event_id == id }
    if esi
      # Dispose Existing Event
      @character_sprites[esi].dispose if !@character_sprites[esi].disposed?
      @character_sprites.delete_at(esi)
    else
      esi = $game_map.events.values.size - 1
    end
    # Refresh new region event
    @character_sprites.insert(esi, Sprite_Character.new(@viewport1, $game_map.events[id]))
  end
end

#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - gre_event_id
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Event ID
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def gre_event_id
    @id # Get Event ID
  end
end

#==============================================================================
# ** Game_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten method - region_effect
#==============================================================================

class Game_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Region Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def region_event(dx, dy, event_id, map_id)
    # Retrieve event from the spawn map
    map_id = @map_id if map_id == 0
    event = generated_region_event($data_spawn_map, event_id)
    # Generate ID
    new_id = @effect_var.length < Region_Effects::MAX_EFFECTS ?
      (@events.keys.max.nil? ? 1 : @events.keys.max + 1) : @effect_var.shift
    @effect_var.push(new_id)
    # Create new Event
    @events[new_id] = Game_Event.new(@map_id, event)
    @events[new_id].moveto(dx, dy)
    SceneManager.scene.spriteset.gre_refresh_event(new_id) # Refresh Event
  end
end

Place it below galv's script but still above Main.

pokeball YinOfflineFemale
**
Rep:
Level 86
Everytime you walk on an event-generating region, galv's script disposes every character sprite and recreates it. This causes the error you detected since the hover sprite is dependent on the existence of the character to whom it is attached; when the character is disposed, so is the hover sprite.

To fix it, I needed to change that mass disposal feature of galv's script and replace it with one that only recreates the character in issue, but I am not entirely sure how that will interact with other scripts or whether it might cause problems down the line. On the plus side, however, it is less resource-intensive and will probably cause less lag in maps with many events.

Anyway, here is the patch:

Code: [Select]
#==============================================================================
#    Hover Alerts + galv's Region Effects
#    Compatibility Patch
#    Version: 1.0
#    Authors: modern algebra (rmrk.net) & galv
#    Date: 5 October 2013
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This patch fixes an error between my Hover Alerts script and galv's Region
#   Effects script. Without it, a hover alert will constantly refresh when
#   walking through an event-generating region.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Insert this script into the Script Editor (F11) in a new slot, somewhere
#   below galv's Region Effects script but still above Main.
#==============================================================================

#==============================================================================
# ** Spriteset_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - gre_refresh_event
#==============================================================================

class Spriteset_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def gre_refresh_event(id)
    # Find any existing event with the same ID
    esi = @character_sprites.find_index {|sprite| sprite &&
      sprite.is_a?(Sprite_Character) && sprite.character.is_a?(Game_Event) &&
      sprite.character.gre_event_id == id }
    if esi
      # Dispose Existing Event
      @character_sprites[esi].dispose if !@character_sprites[esi].disposed?
      @character_sprites.delete_at(esi)
    else
      esi = $game_map.events.values.size - 1
    end
    # Refresh new region event
    @character_sprites.insert(esi, Sprite_Character.new(@viewport1, $game_map.events[id]))
  end
end

#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - gre_event_id
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Event ID
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def gre_event_id
    @id # Get Event ID
  end
end

#==============================================================================
# ** Game_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten method - region_effect
#==============================================================================

class Game_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Region Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def region_event(dx, dy, event_id, map_id)
    # Retrieve event from the spawn map
    map_id = @map_id if map_id == 0
    event = generated_region_event($data_spawn_map, event_id)
    # Generate ID
    new_id = @effect_var.length < Region_Effects::MAX_EFFECTS ?
      (@events.keys.max.nil? ? 1 : @events.keys.max + 1) : @effect_var.shift
    @effect_var.push(new_id)
    # Create new Event
    @events[new_id] = Game_Event.new(@map_id, event)
    @events[new_id].moveto(dx, dy)
    SceneManager.scene.spriteset.gre_refresh_event(new_id) # Refresh Event
  end
end

Place it below galv's script but still above Main.

Thanks MA, your patch fixed 2 of my problems that I was having with the region effects script! Including the one effecting hover alerts.  :ghost: :dino: :discosect:

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
You're welcome! What was the other problem you were having?

pokeball YinOfflineFemale
**
Rep:
Level 86
I was using a smooth scrolling script but it would also jump the screen when walking on a region effect, just like with hover alerts. I removed it because it destroyed my eyes to see my game jumping like that lol, but decided to retry it again with the patch and now it works fine!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member

*
Rep: +0/-0Level 39
RMRK Junior
When the hover is on auto (first comment on page), there is no way to show the picture above other event? (or the char on my case).

I'd like to use this scrip to show an exclamation over the char evertime he passes near a chest, box with an item or to show a picture to press A when he passes near a button. That was the only scrip I found that is close to this.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I received the following private message:

Quote from: REDACTED date=1399252209
Hello, I am using your code for Hover Alerts, and at one point in my game, the player has to talk to a guard before he can pass through a gate. The guard charges him 500 gold to unlock the gate.  Once that happens, the "-500 gold" comes over the players head as an alert then the game crashes.  The error is:  Script 'Hover Alerts' line 265: NoMethodError occurred. undefined method 'empty?' for nil:NilClass

I tried turning off this kind of hover alert, but when i set the auto gain value to 0, it doesn't get turned off.
If you can solve my predicament, then you will have my thanks!

I responded:

Quote from: modern algebra date=1399258812
In the future, please report errors in the script topic itself. That way, other people could potentially step in when I'm away or too busy to help. As well, it is helpful for other users of the script, since the chances are good that you aren't the only person who has received this error.

Anyway, it's likely an incompatibility of some sort, in the sense that another script has changed the order in which certain methods could be predicted to run. It might be fixable simply by changing the position of this script in the editor.

However, it could also probably be fixed by replacing line 265, which should currently be this:

Code: [Select]
      @hover_alert = @hover_alert_queue.empty? ? nil : @hover_alert_queue.shift

with this:

Code: [Select]
      @hover_alert = (@hover_alert_queue.nil? || @hover_alert_queue.empty?) ? nil : @hover_alert_queue.shift

*
Rep: +0/-0Level 38
RMRK Junior
Hey, I pasted the script into the script editor and made sure everything is right, the only problem is I dont know how to use the script, is there a button for the hover alerts or do I insert emotions like [:)] ???
Unfortunately it doesn't say on this thread so... any help would be good.  :pacman:

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Hi hen1, I am not great at explaining how to use my script, but I put the instructions for it in the header of the script from lines 21-142. There are also instructions relating to configuration from lines 158-196.

If you have any specific questions after reading that, then I can try to clarify. However, I am not sure I could do much better a job simply trying to explain it in general than I did in the script itself.

**
Rep: +0/-0Level 38
RMRK Junior
Code: [Select]
Script 'Hover Alerts' line 751: NoMethodError occurred.
undefined method 'hover_alert' for #<Game_Enemy:0x8d1a760>

There is no chance to get this compatible with GTBS, is it?

pokeball YinOfflineFemale
**
Rep:
Level 86
Hi again MA. I was wondering if there was a way to add code into the Hover alert comment call (or if there is a way to call an alert to auto display through script call, that would be even better). I tried to add a conditional for a popup that automatically shows. But it conflicts with the "has to be the first command" rule. Instead of having 2 different pages that do the exact same thing except for the initial hover display, I was wondering it I could add some code to check if something is true or not.
Maybe an eval or condition argument that can change the "name" argument?


I just activated it from a different event. That works out fine.
« Last Edit: September 01, 2014, 06:09:27 PM by Yin »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Glad to hear it. Sorry that I didn't respond right away. I moved a couple weeks ago and only got my internet today.

**
Rep: +0/-0Level 35
RMRK Junior
I could be wrong but I think the :fade_bounce function is not working properly. Right now, it is working exactly like the :fade function.

Code: [Select]
      when :bounce then @effect_y += (@effect_time > 16 ? -0.5 : 0.5)
      when :fade_bounce then self.opacity += (@effect_time > 16 ? -8 : 8)   
      # Temporary Effects
      when :fade then self.opacity = 16*@effect_time if @effect_time < 16
      when :rise_and_fade

The original script doesn't seem to be telling the script to run the bouncing function. I added the bouncing function manually and it seems to be working now.

Code: [Select]
      when :bounce then @effect_y += (@effect_time > 16 ? -0.5 : 0.5)
      when :fade_bounce then self.opacity += (@effect_time > 16 ? -8 : 8)
        @effect_y += (@effect_time > 16 ? -0.5 : 0.5)
     
      # Temporary Effects
      when :fade then self.opacity = 16*@effect_time if @effect_time < 16
      when :rise_and_fade

With that being said, I have 0 experience in coding and I don't really know if it was some other things interfering with the script. Sorry if I am wrong  ;)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Sorry, I can see how that would be confusing. By :fade_bounce, I didn't mean that it would fade and bounce, just that it would start fully transparent, fade in then fade out. Whereas :fade starts out at fully opaque and just fades out. But certainly, if you're looking for it to fade and bounce then your code seems like it would work.

**
Rep: +0/-0Level 35
RMRK Junior
Ohhh, okay. Sorry, my mistake.  :( I always seem to jump the gun like that...


*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Not at all. I'm glad you raised it with me and took the initiative to try and find a solution.

**
Rep:
Level 57
RMRK Junior
Another nice script MA. Would this be able to be used with a proximity effect? Like if you are 2 tiles away then it will fade in and any further than that, it will fade back out? Or if you are one tile away, it will only show if you are facing the direction of the event?

That's too bad, I was looking for an option like this with this script.
Anyway, good jon on this script.

 8)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Another nice script MA. Would this be able to be used with a proximity effect? Like if you are 2 tiles away then it will fade in and any further than that, it will fade back out? Or if you are one tile away, it will only show if you are facing the direction of the event?

That's too bad, I was looking for an option like this with this script.
Anyway, good jon on this script.

 8)

Why is that too bad? That feature was added to this script shortly after Yin requested it.

*
Rep: +0/-0Level 36
RMRK Junior
Epic script Modern Algebra!
I have a suggestion for a thing I need for my project...
I noticed that if the graphic of the event is set to none, the icon is shown in place of the event [1]
If there's graphic, the icon is shown over the event. [2]
Is there a way to be able to show the icon ON the event even if set the graphic? (like in [1], but this time there's graphic exactly below it)
Thanks in advance

I've been thoroughly enjoying this script, but I second a need for this feature if at all possible!  Any way you could implement it?

**
Rep: +0/-0Level 37
RMRK Junior
Very useful script :D!

I have a little problem: I tried changing the z value of the hover graphic in the line 472,
Code: [Select]
self.z = 500
but for some reason it won't go up from 200 (contrary to the Fix Pictures script). Is there a way to go over that, to let's say 500?
Also, is it possible to align to left a hover text?

Not critical problems but I'd love to know :3 Thanks!

やれやれだぜ。