Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : An algorithm for Image-Overlaying numbers
New Topic New Poll Post Reply
Poster Message
averagemoe
Level: Smitemaster
Avatar
Rank Points: 557
Registered: 03-22-2012
IP: Logged
icon An algorithm for Image-Overlaying numbers (+4)  
Sometimes, you want to clearly communicate the value of a variable to the player, but maybe you're doing it so often that using a speech command would clutter up the dialogue transcript (I'm looking at you, Val Unrich and The Mining Business). The Room Location text is okay, but can be a little inconvenient for the player to constantly be looking at. If only you could do it with an Image Overlay.

This script needs only two things. A number to display, stored in the "number" variable, and an image of all the digits of Arabic Numerals, starting with 0 and counting up to 9. This version works for a font where each digit is 14 by 17 pixels arranged horizontally.

  Set var "figures" = 10
Label get figures
  If ... 
        Wait until var "number" > figures
     Set var "figures" * 10
     Go to get figures
  If End 
  Set var "imgX" = _MyX*22
  Set var "imgY" = _MyY*22
Label write
  Set var "digit" = ((number%figures)/(figures/10))*14
  Image overlay XXXXX,SetX $imgX$ SetY $imgY$ DisplayRect $digit$ 0 14 17 displayturns 1
  If ... 
        Wait until var "figures" > 10
     Set var "figures" / 10
     Set var "imgX" + 14
     Go to write
  If End 


You could also modify the commands that set the imgX and imgY variables, if you want it to show up somewhere other than the character's tile.

____________________________
The internet is no place to act like a wild animal.
05-28-2025 at 08:47 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : An algorithm for Image-Overlaying numbers
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.