I have a problem

65 views
Skip to first unread message

rob tabb

unread,
Feb 25, 2021, 9:22:31 AM2/25/21
to PuzzleScript
I'm trying to make a switch like system, I tried wires and can't seem to pull it off.

If I do:
[ Wire_Inactive | Wire_Active ] -> [ Wire_Inactive | Wire_Inactive ] again
[ Wire_Active | Wire_Inactive ] -> [ Wire_Active | Wire_Active ] again

I get:
download (2).gif

If I switch the  rules around, I get:
download (1).gif

I think the first rule overwrites the opposite rule.

If anyone has an easier way to make it, send the rules to this topic please.
Here's the game:

title Levels

flickscreen 7x7
text_color black
background_color white
norepeat_action

========
OBJECTS
========

background
white

Player
#000000 #ffffff
00000
00000
01010
00000
00000

Goal
yellow

Wall
#090909 #0d0d0d
00010
11111
01000
11111
00010

Box
#dd5555 #aa5555
00000
00110
01010
01100
00000

Pillar_Inactive
#090909 #0d0d0d
00000
.010.
.010.
.010.
00000

Wire_Inactive
#eeeeee
.....
..0..
.000.
..0..
.....

Pillar_Active
#999909 #dddd0d
00000
.010.
.010.
.010.
00000

Wire_Active
#999909
.....
..0..
.000.
..0..
.....

Door
brown

wat
#444444
00000
00000
.....
.....
.....

=======
LEGEND
=======

.=background
G=Goal
P=Player
W=Wall
B=Box
`=Pillar_Inactive
~=Pillar_Active
D=Door
L=wat
T=wat and Box
X=Wire_Inactive


=======
SOUNDS
=======

Player move 214
Pillar_Inactive action 4
Pillar_Active action 4

================
COLLISIONLAYERS
================

background
wat,Wire_Inactive,Wire_Active
Goal
Player,Wall,Box,Pillar_Inactive,Pillar_Active,Door

======
RULES
======

[ > Player | Box ] -> [ > Player | > Box ]
[ action Player | Pillar_Inactive ] -> [ Player | action Pillar_Active ]
[ action Player | Pillar_Active ] -> [ Player | action Pillar_Inactive ]
[ Pillar_Active | Wire_Inactive ] -> [ Pillar_Active | Wire_Active ]
[ Pillar_Inactive | Wire_Active ] -> [ Pillar_Inactive| Wire_Inactive ]
[ Wire_Inactive | Wire_Active ] -> [ Wire_Inactive | Wire_Inactive ] again
[ Wire_Active | Wire_Inactive ] -> [ Wire_Active | Wire_Active ] again

==============
WINCONDITIONS
==============

all Goal on Player

=======
LEVELS
=======

wwwwwww
wlllllw
w.....w
w.p.g.w
w.....w
w.....w
wwwwwww

wwwwwww
wlltllw
w..b..w
w..b..w
w..b..w
wwwwwww

wwwwwww...........w.........wwwwwww
wlllllw...w.......l.........wlllllw
w.....w...l...........w.....w.....w
w..p..l.....w.........l.....l..g..w
w.....w.....l........w......w.....w
w.....w........w.....l......w.....w
wwwwwww........l...........wwwwwwww

wwwwwww.......wwwwwww
wlllllw.......wlllllw
w.....wwwwwwwww.....w
w..p..lllllllll.....w
w.....wwwwwwwww.....w
w.....w.......w.....w
wwwwwww.......www.www
................w.w..
................w.w..
................w.w..
................w.w..
................w.w..
................w.w..
................w.w..
..............www.www
..............wll.llw
..............w.....w
..............w..g..w
..............w.....w
..............w.....w
..............wwwwwww

wwwwwww.......
wlllllw.......
w.....wwwwwwww
w.`p.xdlllllgw
w.xxxxwwwwwwww
w.....w.......
wwwwwww.......

lucas.sa...@gmail.com

unread,
Feb 25, 2021, 9:46:33 AM2/25/21
to PuzzleScript
Hey!

First, you don't need to add the again command on those rules, once a rule executes, it tries to execute again, so in a single turn a rule like


[ Wire_Inactive | Wire_Active ] -> [ Wire_Inactive | Wire_Inactive ]

Will set all the wire to inactive.

Second, the problem you have here is on the order of operations, whenever you have a wire_inactive next to a wire_active, the first rule between those two will change the whole wire, so whenever you reach to the second rule the wire is all active or all inactive and the conditions aren't met.

I would separate (reorder) the rules for the two possible interactions with the wire:


[ action Player | Pillar_Inactive ] -> [ Player | action Pillar_Active ]
[ Pillar_Active | Wire_Inactive ] -> [ Pillar_Active | Wire_Active ]
[ Wire_Active | Wire_Inactive ] -> [ Wire_Active | Wire_Active ]

[ action Player | Pillar_Active ] -> [ Player | action Pillar_Inactive ]
[ Pillar_Inactive | Wire_Active ] -> [ Pillar_Inactive| Wire_Inactive ]
[ Wire_Inactive | Wire_Active ] -> [ Wire_Inactive | Wire_Inactive ]

This way, in each turn that the action key is pressed a single chunk of rules would be executed.

I hope this helps,


rob tabb

unread,
Feb 25, 2021, 11:40:16 AM2/25/21
to PuzzleScript
Thank you so much!

Connorses

unread,
Feb 26, 2021, 12:35:58 AM2/26/21
to PuzzleScript
I have done something like this.
This is the simplest way I know of to make sure that contiguous wires are only active if they are touching an active pillar:

[Wire_Active] -> [Wire_Inactive]

[Switch_Active|Wire_Inactive] -> [Switch_Active|Wire_Active]

[Wire_Active|Wire_Inactive] -> [Wire_Active|Wire_Active]

Reply all
Reply to author
Forward
0 new messages