Author Topic: Scripting (with condition checks) is not easy  (Read 3254 times)

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Scripting (with condition checks) is not easy
« on: May 30, 2004, 01:08:38 PM »
I thought I had the problem licked but nope.  There is a creature (ISHADMT1 - I think that that's the dialog file) that speaks before they make their final break out of Irenicus' orignial dungeon.  In checking with DLCTEP this creature doesn't have a death variable - only "None".  But I want the script to activate after they encounter it.  Thought I had a nifty workaround with the Global SPRITE_IS_DEADNONE variable where I set it to a certain value but nope,  if there's an add on or more than the "Greater Than test" it screws up.  Is there anyway to check if my sprite has reached a certain set of coordinates in the dungeon a la "AreaCheck" where it checks to see if my sprite has passed the x and y coordinates?  That would ensure the dialog triggering when I wanted it.

I've been looking at some of the Baldurs Gate NPC party scripts and that doesn't help.  They do AreaChecks and checks for the Death Variable.  Since this Shadow Thief assassin doesn't have one but the default "None" this makes life difficult.

Thanks.

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Scripting (with condition checks) is not easy
« Reply #1 on: May 30, 2004, 01:20:36 PM »
You can give him a death variable via the .tp2 file.

COPY_EXISTING ~ISHADMT1.cre~ ~override~
  WRITE_ASCII 0x280 ~SomeDeathVariable~

This will only be effective, I believe, in new games (or save games where you have not yet entered the area where this creature spawns.)
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Scripting (with condition checks) is not easy
« Reply #2 on: May 30, 2004, 04:04:44 PM »
Quote
WRITE_ASCII 0x280 ~SomeDeathVariable~
The "Write_Ascii stuff is totally new to me ".  I'll give it a try but can you point me to one of the established tutorials so I can understand what I'm doing with this?

Thanks.

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Scripting (with condition checks) is not easy
« Reply #3 on: May 30, 2004, 04:40:51 PM »
You could try the WeiDU Readme.  Japheth's tutorial on READ_BYTE and IF_EVAL talks (briefly) about WRITE_ASCII.
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Scripting (with condition checks) is not easy
« Reply #4 on: May 30, 2004, 05:26:06 PM »
To come to Kismet's rescue, I'll give a brief run-down.

Whenever a file has a text field in it (i.e. a Death Variable, an item ResRef in inventory, a script), it's in ASCII.  And that's about all there is to it.

If you want to have a .cre with an override script of MyScript.bcs, you'd do WRITE_ASCII 0x248 ~MyScript~.

A good way to find out the offset (that'd be the "0x248" bit), is to use NI and turn on the option to show hex offsets.  I'm not sure if DLTCEP has a feature to do this or not.
Earn Money Sleeping.

Offline SimDing0™

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: Scripting (with condition checks) is not easy
« Reply #5 on: May 30, 2004, 05:42:05 PM »
Whenever a file has a text field in it (i.e. a Death Variable, an item ResRef in inventory, a script), it's in ASCII.  And that's about all there is to it.
Bear in mind that sometimes text fields are more than 8 bytes (ARE structure is the best example), which means that a single READ/WRITE_ASCII statement can't cover it.

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Scripting (with condition checks) is not easy
« Reply #6 on: May 30, 2004, 09:05:32 PM »
Thanks all - I did what Kismet suggested and saw that it assigned a DV to the creature.  Unfortunately I didn't have a save game before they encountered it but I'll see what happens on my next dungeon romp to see if that section of my script works.

As for NI - unfortunately I'm on dial-up and while NI itself is small in size, the java stuff needed to run it is not so I can't use it.

Will take another look at the Weidu Tutorials. Thanks again.   ;).

Edited to add - just did the dungeon romp and it worked perfectly!  On to the next layer of bugs! :D  While coding  gets frustrating at times I have to admit it is extremely rewarding seeing the sprite come to life before your eyes.
« Last Edit: May 31, 2004, 05:57:54 PM by Diana »

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Scripting (with condition checks) is not easy
« Reply #7 on: May 30, 2004, 09:39:44 PM »
As I recall, the JRE is only like 4 megabytes, isn't it?
Earn Money Sleeping.

Offline icelus

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3173
  • Gender: Male
Re: Scripting (with condition checks) is not easy
« Reply #8 on: May 30, 2004, 09:44:26 PM »
Yeah.  But there is a SDK version that's much bigger.  It's confusing on which one to get.
<Moongaze> Luckily BWL has a very understanding and friendly admin.

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Scripting (with condition checks) is not easy
« Reply #9 on: May 30, 2004, 09:47:48 PM »
Right.  The Developer's Kit isn't the one you want.
Earn Money Sleeping.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: