Author Topic: problems with $SetWall function  (Read 308 times)

Online marainein

  • Sr. Member
  • ****
  • Posts: 338
Re: problems with $SetWall function
« Reply #15 on: March 04, 2017, 01:53:47 PM »
If you want to replace "no wall" with another wall, you have to place a "transparent" wall at the place where the other wall shall be placed.
I'm very confused by this.

Sorry, probably due to my limited English abilities.
What I meant is:
If you have two squares without a wall between them, and then try to place a wall between the squares in game using the $setwall function or a logic block, it might not work.
I am not sure if it works when the wall you try to place is in the default format, I have to admit. It does in any case not work if you use a wall in another format.
The way to avoid the problem is to make an "empty" wall template like the one I have attached (this is what I meant with "transparent wall" above) and place it between the squares. Then, you can replace this "empty wall" with another one in the same wall format.
Your English is fine - it's my cognitive abilities that are a bit lacking here. So is it possible to get around the format problem by making two calls to $SetWall() - one to fix the format problem (using the wall image WYA_0.png you just posted), the next to place the actual wall we want?

Something like:
Code: [Select]
$SetWall(level, x, y, facing, wall_wya_0);
$SetWall(level, x, y, facing, wall_final);

I have just tried that, and I couldn't get it to work, but maybe I'm doing something wrong.

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2075
    • Dinonykos Dungeon Craft
Re: problems with $SetWall function
« Reply #16 on: March 04, 2017, 03:02:37 PM »
Sorry, no. You have to place the "empty" wall already in the editor in wall mode. You use it as a placeholder.
In other words, you don't use wall slot 1, which is reserved for "no wall", but any other slot, in which you have placed your empty wall (wya_0.png in my case).
Then, you can use the script to change into another wall of the same format.

Maybe Paul/Manikus can change it that way that you can replace every format?
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage:
The Fiend's Ritual - Rise of the Insectoids -
Snow Tigress - Case of the stolen Masterpiece
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2083
Re: problems with $SetWall function
« Reply #17 on: March 04, 2017, 04:30:13 PM »
Quote
Maybe Paul/Manikus can change it that way that you can replace every format?

I hope so.  Unfortunately I don't know what any of the
words in these posts mean.  Manikus will help me understand
the problem and I feel we can probably do something useful.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9368
Re: problems with $SetWall function
« Reply #18 on: March 06, 2017, 01:40:02 PM »
Okay, I tried this out and came to teh same conclusion as Dinonykos.

At first blush, I want us to do what we did with this issue for the three walls in the same slot (one being used as the base wall, one as the overlay and one as the door), and that is to say that they all need to be the same wall format or else a graphics error will occur. In addition, I thinnk we should strongly recommend that anyone wanting to do this type of thing have all of their walls in the same format.
Perhaps Dan Morton can be found and convinved to add to his wallgen tool the ability to take a wall in one format and put it in another - it is only cutting and pasting. Or if anyone is using PSP8, I would be happy to share my scripts.

I don;t think this is the answer that people want, but it would be a heck of a lot of work on Paul's part to make this work, because there is no way that he can cover all of the possible formats, since they are user defined.

Online marainein

  • Sr. Member
  • ****
  • Posts: 338
Re: problems with $SetWall function
« Reply #19 on: March 06, 2017, 02:05:11 PM »
I'm not doing anything fancy - just using the default walls that came with the game, and without doors or overlays. The exact same wall that works fine when placed from the editor fails when placed from a script.

I don't understand DC's internal data structures - how does it know which format goes with which image? Does it store wall format information for each of the 4 walls for every square on the map?

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2075
    • Dinonykos Dungeon Craft
Re: problems with $SetWall function
« Reply #20 on: March 06, 2017, 02:21:13 PM »
If you use walls in the default format, try placing the wall I attached in the editor where you want to let another wall appear in game via script. That should work.
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage:
The Fiend's Ritual - Rise of the Insectoids -
Snow Tigress - Case of the stolen Masterpiece
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2083
Re: problems with $SetWall function
« Reply #21 on: March 06, 2017, 03:54:13 PM »
Quote
how does it know which format goes with which image?

As the current primary developer of the engine, I want
an answer to this very same question.   :P

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2075
    • Dinonykos Dungeon Craft
Re: problems with $SetWall function
« Reply #22 on: March 06, 2017, 04:30:06 PM »
Is this perhaps a bipartite question?

The editor somehow automatically recognizes which wall format is used when you load a wall into a slot. My guess is that this is based on the size of the loaded walls.

What I don't understand is what happens when the $SetWall function is activated in game. It seems like the engine cannot handle to exchange walls of different format, even though the wall formats are correctly recognized in the editor. 
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage:
The Fiend's Ritual - Rise of the Insectoids -
Snow Tigress - Case of the stolen Masterpiece
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Online marainein

  • Sr. Member
  • ****
  • Posts: 338
Re: problems with $SetWall function
« Reply #23 on: March 06, 2017, 04:39:06 PM »
If you use walls in the default format, try placing the wall I attached in the editor where you want to let another wall appear in game via script. That should work.
Dinonykos, thanks - I've already tried this with the first wall you posted, and it does work (kind of - I'm still trying to fix some problems), but it's not an ideal solution - for a start, you have to fill in every square in the map with the transparent wall by hand.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9368
Re: problems with $SetWall function
« Reply #24 on: March 06, 2017, 05:18:05 PM »
Quote
how does it know which format goes with which image?

As the current primary developer of the engine, I want
an answer to this very same question.   :P

It'ss all in the config.txt
The editor and engine know which wall format is which because the format is defined by height and width of the image file (each format must have a unique).
For each wall square, the same goes, though the sizes and positioning on the image do not need be unique.
The only thing hardwired in teh engine/editor is the order in which they are displayed, which is also illustrated in the config.txt.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2083
Re: problems with $SetWall function
« Reply #25 on: March 06, 2017, 06:42:12 PM »
Ah!  I see.  Here is an example:

Code: [Select]
WIDTH_WALL_FORMAT_2 = 500
HEIGHT_WALL_FORMAT_2 = 375
NUM_DISTANT_WALLS_2 = 7
A2_WALL_RECT = 2,2,34,213
B2_WALL_RECT = 150,2,182,213
C2_WALL_RECT = 336,2,368,213

etc. etc

This says that if the wall image (containing all the wall
images for varying distances, etc) is 500 by 375 then
the NUM-DISTANT_WALLS is 7, etc.

So the engine should be able to redefine the wall slot
according to the image size when a $SET_WALL function
specifies a new wall slot. 

Manikus: Get me a mini-mod and I bet I can fix this.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9368
Re: problems with $SetWall function
« Reply #26 on: March 06, 2017, 07:03:00 PM »
Ah!  I see.  Here is an example:

Code: [Select]
WIDTH_WALL_FORMAT_2 = 500
HEIGHT_WALL_FORMAT_2 = 375
NUM_DISTANT_WALLS_2 = 7
A2_WALL_RECT = 2,2,34,213
B2_WALL_RECT = 150,2,182,213
C2_WALL_RECT = 336,2,368,213

etc. etc

This says that if the wall image (containing all the wall
images for varying distances, etc) is 500 by 375 then
the NUM-DISTANT_WALLS is 7, etc.

So the engine should be able to redefine the wall slot
according to the image size when a $SET_WALL function
specifies a new wall slot. 

Manikus: Get me a mini-mod and I bet I can fix this.

Before I make a mini-mod I want to urge that either we broaden this to include the previous issue, so that different formats can work together in the same slot, eg. base wall is hyper wall format, overlay is tall wall format and door is default format (per their respective dfinitions int eh config.txt), or that we solve it the same way by having a message to designers.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2083
Re: problems with $SetWall function
« Reply #27 on: March 06, 2017, 08:09:04 PM »
Make you mini-mod to demonstrate what you want.
I'll try to implement it.  These requests seem reasonable
to me.  I may discover that they are not.  But, let's try.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9368
Re: problems with $SetWall function
« Reply #28 on: March 07, 2017, 02:57:59 PM »
Make you mini-mod to demonstrate what you want.
I'll try to implement it.  These requests seem reasonable
to me.  I may discover that they are not.  But, let's try.

Fair enough. :) Give me a couple of days. I've got some non-DC stuff I need to attend to first. Plus, I thought a third related wall issue - same kind of thing but under a different circummstance, but now I can't remember waht it was, only that it seemed less likely to come up than the toer two circumstances.

Online marainein

  • Sr. Member
  • ****
  • Posts: 338
Re: problems with $SetWall function
« Reply #29 on: March 09, 2017, 01:06:04 AM »
One more observation - walls made with $SetWall() and $SetBlockage() don't seem to show up at combat time.