Post new topic    
Liquid Metal Slime
Send private message
Slices 
 PostSat Jan 02, 2010 6:52 pm
Send private message Reply with quote
I've noticed that there's not any information about slices and how to use them anywhere that I look. I've searched the forums, looked on the hamster republic FAQ, plotscript dictionary, and nothing. Perhaps I'm looking in the wrong place.

Regardless, I'd like to find out exactly what they are and how to start using them. Is there something I am overlooking here or is the really no information out there about them?
Cornbread Chemist
Reigning Smash Champion
Send private message
 
 PostSat Jan 02, 2010 8:17 pm
Send private message Reply with quote
EDIT: Here's a quick introduction. I didn't get around to actually showing how to plotscripting them but all of the commands can be found here and here.

Introduction to Slices

Slices are a new feature implemented into the OHRRPGCE partially for the developers to organize graphics drawing routines, and another in part to give users something to work with in plotscripting.

What are Slices?

Slices are objects with:
- X & Y position
- Width and Height
- Three Slice Extras
- Other slices attached as children

On top of that, there are three types of slices you can define.
Slice Container: A container has the three above, but no graphics. <variable> := create container(width, height)

Sprite Slice: A slice that loads a sprite (can be any of the sprites seen in custom.exe, does not have to be walkabouts) and draws it based on this slice's position. <variable> := load [type] graphic(graphic set, palette)

Rectangle Slice: A slice that resembles a text box or menu. <variable> := create rect (width, height, style)

Slice Children

Slice children is another important part of slices

Not only do slices have a position, a size, extras, and a way it's displayed, but they also can act as Parents to other slices.

What does this mean?
- Any children of the parent will adjust their position based on the parent slice.
- Whenever something is called that affects the parent, all children are affected as well.
- Children can be sorted based on a desired value.
<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
Liquid Metal King Slime
Send private message
 
 PostSun Jan 03, 2010 12:28 am
Send private message Reply with quote
There is some more info on the wiki
Liquid Metal Slime
Send private message
 
 PostMon Jan 04, 2010 5:43 pm
Send private message Reply with quote
Thanks for the info. Can't believe I missed the stuff on the wiki too. I searched for it, but it still didn't come up.
Cornbread Chemist
Liquid Metal King Slime
Send private message
 
 PostMon Jan 04, 2010 6:00 pm
Send private message Reply with quote
I know, I have a hard time finding it on the wiki, and I wrote the dang article. I gotta figure out some way to fix that...
Liquid Metal Slime
Send private message
 
 PostTue Jan 05, 2010 8:37 pm
Send private message Reply with quote
Any idea why this particular script wouldn't make the sprite show up at all?

Code:
plotscript,initialize,begin
   level := 1
   clear string (string:health)
   health := 10
   $1="Health: "
   $2="Time: "
   $3="Score: "
   show string at (1,5,10)
   show string at (2,190,10)
   show string at (3,50,10)
   show string at (string:timer,250,10)
   set timer (1, 60, 18, timer:gameover, string:timer)
   pposx := 99
   healthbar := load small enemy sprite (1)
    place sprite(healthbar, 5, 5)
end

Cornbread Chemist
Reigning Smash Champion
Send private message
 
 PostWed Jan 06, 2010 6:15 am
Send private message Reply with quote
Hmm, being a local variable it's probably getting deleted after the plotscript is finished. Try making healthbar a global variable (you can make it a child of something but it's easier to code constant updates of a health bar if it's a global).
<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
Liquid Metal King Slime
Send private message
 
 PostWed Jan 06, 2010 5:46 pm
Send private message Reply with quote
Even if the variable goes away, that just means you lose the slice handle, the slice itself will still be there.

This is pretty strange. You seem to be using the commands correctly.

Code:

healthbar := load small enemy sprite (1)
place sprite(healthbar, 5, 5)


Actually, I notice that healthbar is NOT a local variable. Am I correct in guessing it is already a global? Could some other script be doing something to it?

Also, you haven't moved or reparented "sprite layer", have you?
Liquid Metal Slime
Send private message
 
 PostFri Jan 08, 2010 6:03 pm
Send private message Reply with quote
James Paige wrote:
Even if the variable goes away, that just means you lose the slice handle, the slice itself will still be there.

This is pretty strange. You seem to be using the commands correctly.

Code:

healthbar := load small enemy sprite (1)
place sprite(healthbar, 5, 5)


Actually, I notice that healthbar is NOT a local variable. Am I correct in guessing it is already a global? Could some other script be doing something to it?


Yep, it's a global. I've changed the global variable to poopiepants to ensure that it wasn't being used by any other script and the sprite still does not show up.

Quote:
Also, you haven't moved or reparented "sprite layer", have you?


I'm not sure what you mean by this Hurr
Cornbread Chemist
Liquid Metal King Slime
Send private message
 
 PostFri Jan 08, 2010 8:56 pm
Send private message Reply with quote
Meatballsub wrote:
Quote:
Also, you haven't moved or reparented "sprite layer", have you?


I'm not sure what you mean by this :hurr:


I guess it is safe to say you haven't moved or reparented it then :)

What happens if you try to put a rectangle slice in the same place?

Code:

healthbar := create rect(30, 30)
put slice(healthbar, 5, 5)
Liquid Metal Slime
Send private message
 
 PostSat Jan 09, 2010 3:54 am
Send private message Reply with quote
Works, thanks Grin
Cornbread Chemist
Display posts from previous: