Welcome to the Builder Academy

Question DG Script crashing game

More
06 Jan 2020 19:57 #8460 by Nero
DG Script crashing game was created by Nero
I have a mob that performs a cycle of walking down the halls of this temple, unlocking, opening doors. I want him to be on a loop where if he gets attacked but not killed, he can still continue on his path. The problem I am having is that once he finishes his first cycle and heads back to starting room, the game crashes when it is detaching the trigger and ending the loop. Not sure what I am missing here.

Code:
Name: 'Orderly: Unlock Route', VNum: [13800], RNum: [ 891] Trigger Intended Assignment: Mobiles Trigger Type: Global Random , Numeric Arg: 100, Arg list: None Commands: %echo% Script fires! %echo% loop13800: %loop13800% if !%loop13800% wait 8 s north set loop13800 1 global loop13800 end while %loop13800% < 100 if %self.fighting% halt end switch %loop13800% case 1 wait 8 s north break case 2 wait 9 s north break case 3 wait 7 s west break case 4 wait 3 s unlock door wait 4 s open door wait 10 s east break case 5 wait 4 s south break case 6 wait 6 s south break case 7 wait 7 s south break case 8 wait 10 s west break case 9 wait 6 s west break case 10 wait 7 s west break case 11 wait 7 s south break case 12 wait 1 s unlock door wait 4 s open door wait 10 s north break case 13 wait 6 s east break case 14 wait 7 s east break case 15 wait 6 s east break case 16 wait 10 s south break case 17 wait 7 s south break case 18 wait 7 s south break case 19 wait 7 s east break case 20 wait 1 s unlock door wait 4 s open door wait 10 s west break case 21 wait 4 s north break case 22 wait 6 s north break case 23 wait 7 s north break case 24 wait 10 s east break case 25 wait 6 s east break case 26 wait 7 s east break case 27 wait 7 s north break case 28 wait 1 s unlock door wait 4 s open door wait 10 s south break case 29 wait 8 s west break case 30 wait 6 s west break case 31 wait 6 s west mgoto 13840 attach 13801 %self.id% unset loop13800 detach 13800 %self.id% break done eval loop13800 %loop13800% + 1 global loop13800 done

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

More
07 Jan 2020 09:28 #8461 by WhiskyTest
Replied by WhiskyTest on topic DG Script crashing game
Hey Nero! Can you get some crash data using gdb?
I'm not great with triggers, would you mind explaining the purpose of detaching the trigger?

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

More
07 Jan 2020 10:03 #8462 by Nero
Replied by Nero on topic DG Script crashing game
I will grab some crash logs and post it asap but as for the trigger itself:
on the first passage through the halls, the mob unlocks, opens doors
once he gets to returning position the current trigger, is supposed to detach and attach a new trigger that has him follow the same path but instead goes into the rooms, clears any items on the floor, then closes the door behind him and locks it.

The crash is occurring after the first run and he returns to his original position. (detaching trigger for 1st loop and attaching trigger for second)

I want the mob to be killable so high level players can loot his keys instead of waiting on him to unlock the doors.

The second DG trigger is here
Code:
Commands: north wait 6 s east wait 7 s east wait 6 s east wait 10 s south wait 7 s south wait 7 s south wait 7 s east wait 1 s open door wait 5 s open door east wait 4 s get all wait 1 s open door west wait 1 s close door lock door wait 10 s west wait 4 s north wait 6 s north wait 7 s north wait 10 s east wait 6 s east wait 7 s east wait 7 s north wait 1 s open door wait 5 s open door north wait 4 s get all wait 1 s open door south wait 1 s close door lock door wait 10 s south wait 8 s west wait 6 s west wait 6 s west mgoto 13884 drop all look %load% obj 13839 %load% obj 13840 %load% obj 13842 %load% obj 13841 mgoto 13840 %echoaround% %self% %self.name% unloads a bag full of collected trash into the temple incinerator. attach 13800 %self.id% detach 13802 %self.id%

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

More
07 Jan 2020 18:27 #8463 by Parnassus
Replied by Parnassus on topic DG Script crashing game
Do you know where the script crashes because you've run tests or because you can see what's happening? The way I usually check is by putting in echos before each command such as:

echo attach 13801 self.id
attach 13801 %self.id%
echo unset loop13800
unset loop13800
wait 10s (during this time, stat the mob)
echo detach 13800 selfid
detach 13800 %self.id%
wait 10s (during this time, stat the mob)
echo break
break
done

It seems to me that I had some problems with breaks, ends, halts and dones but I can't find my notes on that so you might try playing with those.

Also, does the second trigger work properly? And: what happens when you take out the movements? IE, replace case 2 with case 31.

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

More
07 Jan 2020 22:19 #8464 by Nero
Replied by Nero on topic DG Script crashing game
here is gdb pic although it doesn't really tell me much



the crash seems to be happening randomly but its usually close to the end of the first passage, typically when he gets back to the starting room but occasionally it happens 1 or 2 rooms before as well.
Attachments:

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

More
08 Jan 2020 15:16 #8465 by WhiskyTest
Replied by WhiskyTest on topic DG Script crashing game
Yeah not much to go on there. GDB can give a bit more info, have a look at this guide:
tbamud.com/forum/4-development/6-debugging-tutorial-for-gdb

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

Time to create page: 0.195 seconds