Lightning Heroes

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Every slice always has a parent. lt is impossible for a slice not to have a parent. By default, if you have not manually patented a slice, it's parent will be the sprite layer.

All of the slices in a collection are children of a container

Code: Select all

variable(foo)
foo := load slice collection(9)
# do stuff
free slice(foo)
the above example frees the entire collection.

As for the rectangle that won't move, can I see a code example?
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

Oh, I didn't know freeing slices worked with collections already.

As for the rectangle,

Code: Select all

collection:= load slice collection (1)
 Box:= lookup slice (sli:box, collection)
 set slice x (box, -50)
That is really absolutely all that's going on. No loops, no conditions, nothing fancy. I've tried the same thing with sprites and text and they both worked perfectly, I see no reason why the rectangle would be of an exception. But it is. :(
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Can you export the slice collection to a file and send it to me?

Also, I am curious what happens if you do this:

Code: Select all

show value(slice x(box))
wait(10)
set slice x(box, -50)
show value(slice x(box))
Last edited by Bob the Hamster on Sun Jul 18, 2010 10:40 pm, edited 1 time in total.
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

I'll need your E-Mail to send you the slices. (Yes, I'm really THAT lazy. :p )

I tried the show value command, and It did indeed change. So i'm assuming everything's working fine but for some reason the graphics aren't updating to show the box's new position?

Edit: I changed from -50 to -60, and it looks like It's creating a new slice in the new position on top of the old one, which is why It looked like it wasn't moving. ( The portrait hid the borders when it was at -50)
Last edited by Sh4d0ws on Sun Jul 18, 2010 10:50 pm, edited 1 time in total.
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

Free slice (Collection) Did not free the collection. I'm just curious, but has anybody else had any of these problems?
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Sh4d0ws wrote:Free slice (Collection) Did not free the collection. I'm just curious, but has anybody else had any of these problems?
did you use the collection ID number? That won't work. If you used the variable that holds the return value from "load slice collection" that should work.
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

No, I used the variable.

There's another problem I'm having, too: Whenever I use a door, or teleport to map 7 from map 8, the screen becomes completely black. But the menu still looks fine, and opening the map reveals that I am indeed at my target destination, and I can still move around. Prior te recently, doors worked absolutely fine. I still need to test it, but I think using the door via scripting's presenting the problem, and if I used it manually It should work fine.
User avatar
Newbie Newtype
Reigning Smash Champion
Posts: 1873
Joined: Mon Oct 15, 2007 9:44 pm

Post by Newbie Newtype »

Downloaded the demo yesterday. The maptiles are great.
<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Sh4d0ws wrote:No, I used the variable.
Curious.

Here are some questions that might help me understand what is going on:

* What is the purpose of the slice collection you are loading?
* When exactly do you load it?
* What do you do with the slice collection while it is loaded?
* Why do you (want to) free the whole collection at once?
* When exactly do you attempt to free the collection?
Sh4d0ws wrote:There's another problem I'm having, too: Whenever I use a door, or teleport to map 7 from map 8, the screen becomes completely black. But the menu still looks fine, and opening the map reveals that I am indeed at my target destination, and I can still move around. Prior te recently, doors worked absolutely fine. I still need to test it, but I think using the door via scripting's presenting the problem, and if I used it manually It should work fine.
Since you can still see the menu, I don't think this is related to the fade-out-fade-in of moving from map to map.

The tag debug screen (F10) will tell you what scripts are running. I am wondering if the map autorun for map 8 is interfering with the completion of the script that takes you from map 7 to map 8...
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

The slice collection is just something that I want to come up when the menu does, to show you your HP and MP without you needing to go to the status screen.

It's loaded on keypress esc, to go with the menu.

While It's loaded, It doesn't do anything.

I want to free it all at once, with the close menu prompt, so that it doesn't stay there when the menu's closed.



The F10 screen says the only running script is the map autorun scrript. The autorun script is a while loop that I use to get the clouds scrolling across the map. The script also loads the proper palette for that map.

If the While loop is really stopping the transition, would simply walking the player to the door fix the problem?
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Sh4d0ws wrote:The slice collection is just something that I want to come up when the menu does, to show you your HP and MP without you needing to go to the status screen.

It's loaded on keypress esc, to go with the menu.

While It's loaded, It doesn't do anything.

I want to free it all at once, with the close menu prompt, so that it doesn't stay there when the menu's closed.
That sounds pretty simple.

I am wondering if the slice handle that you are getting from the "load slice collection" call is getting clobbered somehow... Try this

Code: Select all

sl &#58;= load slice collection&#40;n&#41;
show value&#40;sl&#41;

# do everything else

show value&#40;sl&#41;
free slice&#40;sl&#41;
And let me know if you see the same value right after loading the collection and right before freeing it.

Oh, also it would be helpful to know if you are reparenting any slices, and if so which ones and why.
The F10 screen says the only running script is the map autorun scrript. The autorun script is a while loop that I use to get the clouds scrolling across the map. The script also loads the proper palette for that map.

If the While loop is really stopping the transition, would simply walking the player to the door fix the problem?
In the script that causes you to use the door from map 7 to map 8, is anything supposed to happen after the "use door" command? If so, the while loop would be preventing it from happening.

Actually, if you can spare one of your timers, you can eliminate your loop entirely.

Code: Select all

plotscript, map autorun, begin
  scroll clouds
end

script, scroll clouds, begin
  if&#40;current map <> 8&#41; then&#40;exit script&#41;
  # do a step of cloud scrolling with no waits
  set timer&#40;5, 0, 1, @scroll clouds&#41;
end
The above example uses timer#5 to repeat scroll clouds script once every tick without blocking other scripts until you leave map 8.
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

How exactly would I move clouds? For the While loop all I did was set the parent's X/Y position and then increment the variables I used. For the timer, this isn't working, and it's slowing down the game to about 13 FPS.

The script doesn't have anything happening after using the door, either. Although I certainly plan on adding things, so sticking with the timer's best.

For the Values of the collection, It's definitely getting clobbered. It opens up as a fairly random number, and increases by set increments every time I close and re-open it.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Can I see the whole code of the while loop in the map autorun on map 8?

As for the collection, is it possible that you might accidentally be loading the collection twice? Then the second copy would be unloaded, but it would look like nothing happened because the first copy is still there.
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

It's very possible that I could be loading the collection twice. It's summoned on keypress esc, and because that's what you use to close the menus, wouldn't it be opening it again?

But the problem is, when I first started getting this problem, I tried assigning closing the interface to a menu item, and it still wouldn't unload. I'll try again, to be sure, but even if it is being summoned twice, I'm not sure if that's the whole problem. If it is, though, would it be possible to just free it twice? I did try that and it said it was already deleted.

As for seeing the while loop; I'll put it up when I get to re-writing it.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Sh4d0ws wrote:It's very possible that I could be loading the collection twice. It's summoned on keypress esc, and because that's what you use to close the menus, wouldn't it be opening it again?
The "trace" command can be even more useful than the "show value" command in situations like this. Trace a string right after the "load slicde collection" command, and then check your g_debug.txt file to see how many times it happened.
Sh4d0ws wrote:... If it is, though, would it be possible to just free it twice? I did try that and it said it was already deleted.
That can't work if both handles are getting stored in the same variable. The second handle would clobber the first.
Post Reply