Post new topic    
Page «  1, 2, 3, 4, 5, 6 ... 26, 27, 28  »
Reigning Smash Champion
Send private message
 
 PostWed Nov 23, 2016 2:41 am
Send private message Reply with quote
I wrote some scripts for when I display score on the screen. One is designed for arcade style fixed length scores where zeroes fill empty digits, and the other is designed for nicer looking high score tables (that can also be used just as a general script for adding commas to large number strings).

I did test the scripts but I can't guarantee they'll work perfectly, though.

Code:
# Two scripts for drawing scores, one to add zeroes to make a score display fixed,
# and another to add commas between every thousanth place
# These scripts can be combined, but recommended to be used on separate occasions

# Useful for arcade-style score displays that feature 0's in unfilled digits
script, appendZeroestoString, str, length, begin
   # Note for length, 32 bit integers don't have more than 10 digits so it is pointless to do this with values
   # with digits greater than that
   variable (tempHold) # Needed to store the string's value
   
   length := length -- string length (str) # Find out how many zeroes we don't want to overwrite
   # Next store the value of the string and then clear it
   tempHold := number from string (str) # Default for 2nd argument is kept to prevent masking bugs
   clear string (str)
   
   # Countdown from length to add the zeroes
   while (length) do (
      append number(str, 0)
      length := length -- 1
   )
   
   # And then add the stored number to the end
   append number (str, tempHold)
end

# Adding commas is useful for high score lists or general purpose displaying of large numbers
script, addCommastoNumberString, str, tempStr=99, begin
   variable (count) # Used to cycle comma placement
   count := 2   # Starting point, it cycles between 2-0
   
   # Temporary string needed because I can't think of a way to do it without a duplicate string
   copy string (tempStr, str)
   clear string (str)
   
   # Create the new string
   while (string length(tempStr)   ) do (
      # Append the end of the string to the new string
      # This will make the string backwards, but that is intentional
      # As there's no way to insert to front of strings, the commas later are placed
      # backwards, which we need to fix by reversing the whole string later
      append ascii (str, ascii from string(tempStr, string length(tempStr) )   )
      delete char  (tempStr, string length(tempStr)   )  # Delete that character
      
      if (count <= 0) then (
         $str + ","
         count := 3
      )
      count := count -- 1
   )
   # Now we need to reverse the string. We use tempStr again for this
   copy string (tempStr, str)
   clear string (str)
   
   while (string length(tempStr)   ) do (
      append ascii (str, ascii from string(tempStr, string length(tempStr) )   )
      delete char  (tempStr, string length(tempStr)   )  # Delete that character
   )
   
   # Finally, trim any extranneous commas
   if (ascii from string(str) == 44) then (delete char(str, 1)   )
end

<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
Liquid Metal Slime
Send private message
 
 PostWed Nov 23, 2016 5:51 am
Send private message Reply with quote
Trytuges0019.png
Knate the Knight, Thriff the Thief, Wizardbeth the Wizard, and Claire the Cleric.
Trytuges0014.png
You think AGI of 13 sucks? Try being the *actual* Spellshard FIGHTER.
Trytuges0028.png
Investigate freaking everything. I used 100 textboxes just in the house the heroes start in and plan to follow a similar trend in the other four maps (not the overworld).
Hopefully I can actually complete something. And how better to do that than to take vague memories of a game I made in my teens as a prototype? The first game I ever finished making, short as it was.

I'm using the graphics from Fnrrf's recently-released graphics pack because they perfectly fit the aesthetic I want. Some of the graphics are edited, even to the point of breaking the three-colors rule, but always with good reason.

This is just a straightforward and basic RPG, the kind that the Heart of the OHR contest was originally intended to encourage. It has four heroes (a knight, a thief, a wizard, and a cleric) who all set out together on an epic quest to fight the overlord of the skull-shaped island.

Travel to literally all the locales the world has to offer!
- The home the heroes start in
- The town that home is part of
- The overworld
- The castle of the king who rules over the town
- The first dungeon
- The last dungeon
Remeber: God made you special and he loves you very much. Bye!
Metal King Slime
Send private message
 
 PostWed Nov 23, 2016 9:57 am
Send private message Reply with quote
That titlescreen listing is really nice. Should have that for the OHR.

appendZeroestoString (shouldn't that be prependZeroesToString?) will get into an infinite loop if 'length' is too short. Better to write "while (length > 0) do (". addCommastoNumberString is a perfect example of how awful string manipulation in the OHR is. I can't actually simplify it much. Probably the best way to simplify it would be to first write a script to insert one string anywhere into another, then you won't need to reverse it.

The caption wrote:
Investigate freaking everything. I used 100 textboxes just in the house the heroes start in and plan to follow a similar trend in the other four maps (not the overworld).

Wowzers. That should be fun. So, a normal RPG, just a really short one? Or are these 4 maps very large?
Liquid Metal Slime
Send private message
 
 PostWed Nov 23, 2016 9:02 pm
Send private message Reply with quote
TMC wrote:
The caption wrote:
Investigate freaking everything. I used 100 textboxes just in the house the heroes start in and plan to follow a similar trend in the other four maps (not the overworld).

Wowzers. That should be fun. So, a normal RPG, just a really short one? Or are these 4 maps very large?


Overworld I don't know how large it's going to be, but it at least needs to have an island shaped like a skull and one other landmass. The starting house is 21x22, the town is a more diffuse 32x32, the castle might be a little bigger than the town or have multiple floors and the dungeons, well, there's not telling but they're probably going to be bigger than the dungeons I've made for my other games.

So yes, it should end up being "normal RPG, but quite short". Just more content-dense in the part of my games people like the most anyway (flavor text).
Remeber: God made you special and he loves you very much. Bye!
Liquid Metal Slime
Send private message
 
 PostThu Nov 24, 2016 1:26 am
Send private message Reply with quote
Nathan Karr wrote:
Overworld I don't know how large it's going to be, but it at least needs to have an island shaped like a skull and one other landmass. The starting house is 21x22, the town is a more diffuse 32x32, the castle might be a little bigger than the town or have multiple floors and the dungeons, well, there's not telling but they're probably going to be bigger than the dungeons I've made for my other games.

So yes, it should end up being "normal RPG, but quite short". Just more content-dense in the part of my games people like the most anyway (flavor text).


This sounds promising. Fnrrf's graphics pack is really nice too. I wondered if someone might use parts of it for the Multicart. I'm glad!

I love adding extraneous text boxes to things. Don't stop at the first house. You can pack descriptive text boxes into every area of the game!
Liquid Metal Slime
Send private message
 
 PostThu Nov 24, 2016 6:39 am
Send private message Reply with quote
Trytuges0031.png
Shading is hard when you have no idea what you're doing
Thanks to Giz for getting the hype going on NES title screens! What I did was I made a 16x10 map screen, put some tiles in, took a screenshot, edited that screenshot in MSPaint, and re-imported it.

The "press any key" part from the map preview felt appropriate so I left it in.

It took about ten minutes to choose a font, had to go through all of them to make sure I was making the best choice (rather than just using Courier, my go-to font for everything else).
Remeber: God made you special and he loves you very much. Bye!
Liquid Metal Slime
Send private message
 
 PostThu Nov 24, 2016 7:01 am
Send private message Reply with quote
Title screen's looking crisp. I dig it. Got that NES style spot-on.

Choosing a font is always hard. I feel your pain. Sometimes it's better to draw your own words instead, or look at special blackletter fonts or decorated letters for reference and inspiration.
My pronouns are they/them
Ps. I love my wife
Liquid Metal Slime
Send private message
 
 PostThu Nov 24, 2016 9:12 am
Send private message Reply with quote
A quick graphical mockup to show where this game came from:


The second column are mockups from memory. The bearded version of the Spellshard wizard became the first boss, Magus Divunni. The only ripped non-Spellshard graphics in the game were Pikachu's walkabout scattered around the town. (I hand-pixeled them from looking back and forth at my Game Boy and drawing in MSPaint - that's how I thought most sprite ripping was supposed to be done, felt like a genius when I realized I could cut and past from OHR screenshots in MSPaint to steal the graphics from Spellshard in the first place.)

I completed the game, but got disgusted with myself for using stolen assets to do so. I didn't outright delete the game, and long held a soft spot for it in my memory when the computer I made it on and the computer of the one person I gave a copy to both died. This all happened in 2004, roughly a year before I joined Castle Paradox and started interacting with game making peers, or really anyone outside my immediate family, in a social context through my teens or adulthood.
Remeber: God made you special and he loves you very much. Bye!
Metal King Slime
Send private message
 
 PostThu Nov 24, 2016 10:34 am
Send private message Reply with quote
Wow! I never knew that the first demo of Spellshard was released in 2002! It's no wonder I wasn't aware of such an ancient game released roughly when I got here, but I'm surprised that I missed all references to the game being in development hell for a decade!

I like your hybridised graphics. When using a preexisting graphics pack, I guess it's especially important to have your own hero graphics, otherwise your heroes will be from some other game.

Yes, fonts are so hard. It often feels like you'll never get it to look perfect unless you draw some really flash title yourself.
Hmmm... idea forming...
Metal Slime
Send private message
 
 PostThu Nov 24, 2016 11:49 pm
Send private message Reply with quote
Bob the Hamster wrote:

Code:


script, check for sword collision, sword, begin
  # The sword argument is an NPC reference to your sword NPC
  # This script loops through all other NPCs, and checks if the
  # sword hit any of them
  variable(i)
  # NPC references are negative numbers in the range of -1 to -300
  for(ref, -300, -1) do(
    # Make sure this is actually a valid NPC for this map
    if(get NPC ID(ref) >= 0) then(
      # Don't let the sword collide with itself
      if(ref <> sword) then(
        # Check if the sword and NPC collide
        if(slice collide(get npc slice(sword), get npc slice(ref))) then(
          #The sword hits this NPC, run a script
          damage NPC with sword(ref)
        )
      )
    )
  )
end




Something I've been wondering... is the -300 to -1 range just what the engine uses for NPC references, or was that just an example number?

Also I'm not quite sure what an NPC reference is, like is it how the game keeps track of the copies of NPCs that are placed on the map, whereas NPC ID is the 0-99 number of the NPCs you created in Edit NPCs? I did test this script out briefly and it didn't do anything to more than 1 copy of the same NPC, so hopefully there's a way to be able to do stuff to individual copies of the same NPC. That way I don't have to make one NPC for each monster.
Metal King Slime
Send private message
 
 PostFri Nov 25, 2016 10:24 am
Send private message Reply with quote
An NPC reference is a handle/ID number that refers to an NPC instance on the map, as opposed to an NPC definition. It's a handle just like a slice handle, menu handle, or menu item handle.

NPC ID numbers currently go up to 499, not 99.

NPC references currently have values in the range -1 to -300. In future, they won't. If you want to future-proof your scripts, either use "npc reference" and "npc copy count" (which still requires you to make an assumption about the maximum possible NPC ID), or better yet use "next npc reference". James might have forgot about that command because it's quite a new one. James' script is correct for the time being, but here's a more general version:

Code:
script, check for sword collision, sword, begin
  # The sword argument is an NPC reference to your sword NPC
  # This script loops through all other NPCs, and checks if the
  # sword hit any of them
  variable(ref, next)
  ref := next npc reference  # The first NPC on the map
  while (ref) do (
    next := next npc reference(ref)  # The next NPC
    # Don't let the sword collide with itself
    if(ref <> sword) then(
      # Check if the sword and NPC collide
      if(slice collide(get npc slice(sword), get npc slice(ref))) then(
        #The sword hits this NPC, run a script
        damage NPC with sword(ref)
      )
    )
    ref := next  # The purpose of the "next" temp variable is to allow deleting NPC "ref"
  )
end
Liquid Metal Slime
Send private message
 
 PostFri Nov 25, 2016 6:24 pm
Send private message Reply with quote
xenopost.png
More alien creatures...

I need to do a total of 90 creatures. Right now, I have 40. 90 seems like a lot, but my goal is to do 10 a day. By the end of the weekend, I hope to be at 60.
Metal King Slime
Send private message
 
 PostFri Nov 25, 2016 10:11 pm
Send private message Reply with quote
That robot face is one of the ten best things I've seen in my life.
Metal Slime
Send private message
 
 PostSat Nov 26, 2016 10:38 pm
Send private message Reply with quote
Thanks TMC, I'm at least getting some results with that approach, where I was getting nothing before. Though I'm still not able to figure out why certain things aren't happening, namely enemy sprites getting knocked back and their NPC extra data being updated.
Display posts from previous:
Page «  1, 2, 3, 4, 5, 6 ... 26, 27, 28  »