Welcome to the Builder Academy

Question Trigger VNum 40603 has looped 100 times!!!

More
25 Feb 2014 22:09 #4719 by Parnassus
What the trigger is doing is setting up all the exits to make the maze. I actually found it easier and shorter to make my maze by listing all the walls, rather than the exits. I don't know if this will make any sense, sitting here all on its own, but it actually does work.
Code:
set northlist %north.car% set northrest %north.cdr% while %northlist% eval room %zone%%northlist% set northlist %northrest.car% set northrest %northrest.cdr% %door% %room% north purge done %zoneecho% %room% North completed. set eastlist %east.car% set eastrest %east.cdr% while %eastlist% eval room %zone%%eastlist% set eastlist %eastrest.car% set eastrest %eastrest.cdr% %door% %room% east purge done %zoneecho% %room% East completed. <and so on>

The numbers work something like this: 90 rooms, 10 x 9. One corners only have two possible directions, the rest of the edges have only three possible directions. If you consider that about half of the remaining rooms have an exit in the specified direction, that gives the approximate 40 count.

First the trigger purges the exits in all the north walls. That's about 40 loops. The zoneecho fires. Next we do a done, start working on the east walls which is the next 40 or so loops. The zoneecho fires. Then I get the loop error message which shows that the trigger never reached the end of the south walls. Because of this, the only way I can see it is, 40 loops + 40 loops + 20 loops = 100 loop error message.

Now, there was the possibility that, for some reason, south wasn't written correctly and was looping 100 times. That's why I took south and west, moved them to the top. The outcome was the zoneecho for south, the zonecho for west, then the loop error message. This shows me that it wasn't the south exits that had the problem but that the loop count is adding all the loops where I had assumed that each done would reset the count, giving me 40 loops, done, zoneecho, 40 loops, done, zoneecho, 40 loops, done, zoneecho, 40 loops, done, zoneecho with no error message.

I'm obviously wrong there but I need to know why I'm wrong. Thomas said I need to start new loops, but if a done followed by a new while isn't considered starting a new loop, then I need to know what is.

It isn't so much that I won't be able to do what I want to (because there are ways around this) as much as needing to learn what I'm doing wrong. If my syntax is creating an inefficiency, I need to know, but I can't see anything that says my syntax is wrong. Quite often though, it's something really simple that I can't see, simply because if I'd seen it, I wouldn't have written it that way :)

Please Log in or Create an account to join the conversation.

More
27 Feb 2014 22:36 #4721 by thomas
hmm.. your trigger should reset the count after every loop. I think this needs some debugging on the server...

Please Log in or Create an account to join the conversation.

More
28 Feb 2014 22:39 #4723 by Parnassus
I'll have to ask Rumble for a new zone so I can try it out on tbamud but my version is 3.64. Thanks for thinking its not the fault of my poor trigger :)

Please Log in or Create an account to join the conversation.

More
02 Mar 2014 19:41 #4727 by Parnassus
To see it in action on the buildport, goto 21610. There should be an invisible mob there.

Say link (this sets up the grid. You'll be able see in entire grid at this time)
Say testa (this runs trigger with the error. You'll see the north and east run, then the error message)
Say testb (this runs the same trigger except with north and south moved down. East and west will run, the the error message will appear.

To see the maze itself:
Say maze1 (this will set up the north and east exits)
Say maze2 (this will set up the south and west exits)
At this point, it will be possible to go through the maze.

Please Log in or Create an account to join the conversation.

More
04 Mar 2014 14:06 - 04 Mar 2014 14:07 #4734 by drefs
hi all
see one fix to function check triggers.

in file dg_scripts.c around 660 line number.
Code:
void script_trigger_check(void) { char_data *ch; obj_data *obj; struct room_data *room=NULL; - int nr; + room_rnum nr; struct script_data *sc;

[]'s
Drefs
Last edit: 04 Mar 2014 14:07 by drefs.

Please Log in or Create an account to join the conversation.

More
09 Mar 2014 01:12 #4742 by Parnassus
Rumble tried dref's change but the loop error continues.

Please Log in or Create an account to join the conversation.

Time to create page: 0.203 seconds