Journal Update within Distance script wont work

Post » Fri Jan 22, 2010 6:12 pm

So I got this script:
Begin 01mc_visageofdarknessteleportd0r             if ( GetJournalIndex "mc_dissidentpriest" == 150 )                        if ( GetDistance player < 400 )                                       Journal "mc_dissidentpriest" 160                                  endif             endif  End



And i don't know what it is, but whenever I try to attatch it to something to use it, and click save, it's like the cs ignores the command and removes the script from the object. I had this happen on doors before, but im using a gold coin this time. Is there a reason this is happening?
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Fri Jan 22, 2010 6:04 am

Not sure if this is the issue, but I count the script ID as being 32 characters. The maximum length for an ID (NAME subrecord) is 31, since it needs a trailing null (Google for C-style strings for the logic behind that). Starting IDs with anything but a letter is also not recommended (and can cause bugs), so that's neatly solved if you remove the "01" from the start.

Otherwise, the script looks correct (just quote "player").

To make up for removing the "01" prefixes from your IDs and no longer having them sorted to the top, you can jump to a spot in most of the CS lists by quickly typing the first few characters. Just click in the list (with nothing selected for editing), and quickly type "mc_". The selection will jump to your first item.
User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm

Post » Fri Jan 22, 2010 4:17 pm

Not sure if this is the issue, but I count the script ID as being 32 characters. The maximum length for an ID (NAME subrecord) is 31, since it needs a trailing null (Google for C-style strings for the logic behind that). Starting IDs with anything but a letter is also not recommended (and can cause bugs), so that's neatly solved if you remove the "01" from the start.

Otherwise, the script looks correct (just quote "player").

To make up for removing the "01" prefixes from your IDs and no longer having them sorted to the top, you can jump to a spot in most of the CS lists by quickly typing the first few characters. Just click in the list (with nothing selected for editing), and quickly type "mc_". The selection will jump to your first item.

You were correct, it was the to many characters. Thanks! And i know, I just like having 01before mc, makes me feel like im number 1 :cryvaultboy:
User avatar
[Bounty][Ben]
 
Posts: 3352
Joined: Mon Jul 30, 2007 2:11 pm

Post » Fri Jan 22, 2010 3:01 pm

You were correct, it was the to many characters. Thanks! And i know, I just like having 01before mc, makes me feel like im number 1 :cryvaultboy:



Lol. Always use letters. I use the prefix "alx_" for everything. I wouldnt suggest using much more than 3 letters for a prefix. And try and make it unique/relevent to you.

Also: with the script thing, instead of using an item (like gold) that can be seen and possibly moved, etc: i would suggest using the Red Sound editor box thing. (the red thing used for sound placement). Just edit one in the activator list, give it a new code, attach the script and place it somewhere. Because its invisible, you can place it very accurately (like in the middle of a door way) and it will work great. Just a hint
User avatar
Jade MacSpade
 
Posts: 3432
Joined: Thu Jul 20, 2006 9:53 pm

Post » Fri Jan 22, 2010 10:04 am

Lol. Always use letters. I use the prefix "alx_" for everything. I wouldnt suggest using much more than 3 letters for a prefix. And try and make it unique/relevent to you.

Also: with the script thing, instead of using an item (like gold) that can be seen and possibly moved, etc: i would suggest using the Red Sound editor box thing. (the red thing used for sound placement). Just edit one in the activator list, give it a new code, attach the script and place it somewhere. Because its invisible, you can place it very accurately (like in the middle of a door way) and it will work great. Just a hint

Well I place the gold under the floor so that when you walk on top of it the script activates, Although your way does sound easier, Thanks for the tips :D :flamethrower:
User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Fri Jan 22, 2010 5:36 pm

If you want a pressure plate-type trigger, use the marshmallow blue collision boxes. Place one flat on the floor, like you've done with the gold, and use the OnCollidingPC function (check the SFD for reference).

GetDistance, since it uses a sqrt internally, is perhaps the single slowest function in the scripting lang and should be avoided if you easily can. Using it once won't be an issue, but you can play with the effect if you'd like.

If you do want to use a simple distance trigger, then the red editor markers will work.
User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Fri Jan 22, 2010 12:04 pm

If you want a pressure plate-type trigger, use the marshmallow blue collision boxes. Place one flat on the floor, like you've done with the gold, and use the OnCollidingPC function (check the SFD for reference).

GetDistance, since it uses a sqrt internally, is perhaps the single slowest function in the scripting lang and should be avoided if you easily can. Using it once won't be an issue, but you can play with the effect if you'd like.

If you do want to use a simple distance trigger, then the red editor markers will work.



Wow ive never even considered this. Excellent idea. Horray for learning new things even after all this time :D
User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Fri Jan 22, 2010 9:37 am

If you want a pressure plate-type trigger, use the marshmallow blue collision boxes. Place one flat on the floor, like you've done with the gold, and use the OnCollidingPC function (check the SFD for reference).

GetDistance, since it uses a sqrt internally, is perhaps the single slowest function in the scripting lang and should be avoided if you easily can. Using it once won't be an issue, but you can play with the effect if you'd like.

If you do want to use a simple distance trigger, then the red editor markers will work.

Are you talking about that collision walls like surrounding the Chargen boat in Seyda Neen?
User avatar
Taylrea Teodor
 
Posts: 3378
Joined: Sat Nov 18, 2006 12:20 am

Post » Fri Jan 22, 2010 6:05 pm

Yep. 128 or so square and marshmallow blue. They show up in the CS, but are not visible in game. They do process collision, though, so you can use them with collision functions.
User avatar
cosmo valerga
 
Posts: 3477
Joined: Sat Oct 13, 2007 10:21 am

Post » Fri Jan 22, 2010 8:16 pm

Yep. 128 or so square and marshmallow blue. They show up in the CS, but are not visible in game. They do process collision, though, so you can use them with collision functions.

Haha that's wonderful, I had no idea that could be done :D
User avatar
Rudi Carter
 
Posts: 3365
Joined: Fri Sep 01, 2006 11:09 pm


Return to III - Morrowind