Author Topic: Q: multi IF dependent says  (Read 6343 times)

bt_igi

  • Guest
Q: multi IF dependent says
« on: August 13, 2002, 06:07:11 PM »
Hi there,
I'm pretty new at using WeiDu (by the way, thanks for such a great program, its so much fun :).
Anyway, my question, is it possible to have something like this:

IF ~~ THEN BEGIN 0
  IF ~AreaCheck("AR0001")~ THEN SAY ~Your in area 0001~ DO ~~ EXIT
  IF ~AreaCheck("AR0002")~ THEN SAY ~Your in area 0002~ DO ~~ EXIT
END

I can sort of see it being done with multiple blocks, but is it possible similar to how I have written it? I've browsed the forum, readme, examples, test files and a tutorial or 2, and not seen it done, but I might have missed it.
Thanks for your patience,
/bt_igi

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #1 on: August 13, 2002, 06:30:54 PM »
Quote
Hi there,
I'm pretty new at using WeiDu (by the way, thanks for such a great program, its so much fun :).
Anyway, my question, is it possible to have something like this:

IF ~~ THEN BEGIN 0
  IF ~AreaCheck("AR0001")~ THEN SAY ~Your in area 0001~ DO ~~ EXIT
  IF ~AreaCheck("AR0002")~ THEN SAY ~Your in area 0002~ DO ~~ EXIT
END

I can sort of see it being done with multiple blocks, but is it possible similar to how I have written it? I've browsed the forum, readme, examples, test files and a tutorial or 2, and not seen it done, but I might have missed it.
Thanks for your patience,
/bt_igi
                   In very basic terms, you would want those conditions to be in the state trigger slot.

IF ~AreaCheck("AR0001")~ THEN
BEGIN area0001
SAY ~You are in Area 0001.~
IF ~~ THEN EXIT
END

IF ~AreaCheck("AR0002")~ THEN
BEGIN area0002
SAY ~You are in Area 0002.~
IF ~~ THEN EXIT
END

Or, you could do this.

IF ~~ THEN BEGIN start
SAY ~I am going to say something different depending on what area you are in.~
IF ~AreaCheck("AR0001")~ THEN GOTO area0001
IF ~AreaCheck("AR0002")~ THEN GOTO area0002
END

IF ~~ THEN BEGIN area0001
SAY ~You are in Area 0001.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN area0002
SAY ~You are in Area 0002.~
IF ~~ THEN EXIT
END


(Note that you don't have to have a "DO" if you're not actually DOing an action. Note also in the second example we don't have anything special in the state triggers of the places we branch to.)
                   
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #2 on: August 13, 2002, 06:51:07 PM »
So I have to have a block for each area check / reply?
Ah well, thats not so bad I guess, I just wondered if it could be done neater.
I'll use something akin to your second example I think, so thanks for posting it :)
And thanks for the promt reply.
/bt_igi                    

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #3 on: August 13, 2002, 07:11:13 PM »
There is a scenario where you can have something a little closer to what you had in mind, and that's a conditional CHAIN, but it is better to learn to crawl a bit first. :)                    
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Q: multi IF dependent says
« Reply #4 on: August 14, 2002, 01:16:42 AM »
Quote
So I have to have a block for each area check / reply?
Ah well, thats not so bad I guess, I just wondered if it could be done neater.
I'll use something akin to your second example I think, so thanks for posting it :)
And thanks for the promt reply.
/bt_igi
                   The Infinity Engine DLG format requires that you have one separate state for each statement said by an NPC to the player.

Convenient syntax can hide that from you (see CHAIN, as suggested, or "multi-say" for something different but on a similar theme) but under the hood there's still one state per SAY.

After a bit of working with tools like these you'll notice that all of the mods have the same sort of dialogue structure (from a bird's eye view) ... that's because it's all the DLG format really supports. Different things could be hacked in through special scripting conditions, but it would take vast individual effort.

Good luck with WeiDU. I think you're the first person to call it "fun". :-)
                   

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #5 on: August 14, 2002, 12:27:57 PM »
Thanks for the replies!
I havent moved on to CHAIN and MULTI-SAY, yet, I'll just stick with what I (sort of) know for now, until I have it nailed. Things are going well enough, although dialog I am writing is getting pretty big.

Since I'm here, I might as well ask my next question... which I've just solved :-) Thanks for the help you would have given anyway :)
/bt_igi                    

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #6 on: August 14, 2002, 12:53:42 PM »
There's an (ahem) excellent tutorial on multisay and CHAIN2 in the WeiDU README already, although CHAIN2 doesn't do conditional branching. Still, if you have a long dialogue with many states that are linear (non-branching) I IMPLORE you to use it. The time savings is enormous, and I've already spoken with a couple of .d coders who DIDN'T know about them and were very very upset at themselves afterwords. :)

                   
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #7 on: August 14, 2002, 01:30:32 PM »
I've spotted the tutorials in the readme, MULTISAY seems easy enough to use, CHAIN2 is a little beyond me, at the moment (not in understanding, but in use. My current dialog only speaks to the PC, with no interuptsions by others, in a pretty basic yes/no mannor :-)

EDIT: Sorry for all the questions, but this will be the last one for a while (I promise). I notice theres a command for adding references to the .tlk manually, how can you be sure this doesnt overwrite anything? If you can be sure? I'm trying to use DisplayStringHead(Myself,xxxx) to display a string over my head,but I dont know where it will be added in the .tlk, unless I specify it with --strapp. Is it possible without overwriting some random thing? Thanks

Anyway, got to dash, or I'll never finish :)
/bt_igi -waving to the friendly people :-)                    



[!--EDIT|bt_igi|Aug 14 2002, 10:29 PM--]

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Q: multi IF dependent says
« Reply #8 on: August 14, 2002, 05:51:33 PM »
Quote
EDIT: Sorry for all the questions, but this will be the last one for a while (I promise). I notice theres a command for adding references to the .tlk manually, how can you be sure this doesnt overwrite anything? If you can be sure? I'm trying to use DisplayStringHead(Myself,xxxx) to display a string over my head,but I dont know where it will be added in the .tlk, unless I specify it with --strapp. Is it possible without overwriting some random thing? Thanks
If you're thinking of STRING_SET, the answer is "YOU CAN'T". That's why the manual tells you not to use it. :-)

For what you are suggesting, put

DisplayStringHead(Myself,999999)

in your BAF and compile it to a BCS. In your TP2 file, put

COPY ~mymod/myscript.bcs~ ~override/myscript.bcs~
  REPLACE ~999999~ ~Hello, this is a new string that will be over my head.~

When installed on the user's machine, 999999 will be replaced by the strref of a newly-minted string.                    



[!--EDIT|weimer|Aug 14 2002, 04:52 PM--]

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #9 on: August 14, 2002, 06:28:27 PM »
Tashia is a good learning ground for the use of TP2 REPLACE and DisplayStringHead. Take a look at her code.

                   
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #10 on: August 15, 2002, 01:13:45 PM »
"When installed on the user's machine, 999999 will be replaced by the strref of a newly-minted string."

What if someone else has used 999999 to do the same sort of thing? Or does WeiDu interpret 999999 as a "place at the next free space" sort of thing?

I've mostly been using guess work (fun fun fun :) and valen (sounds about the simplest npc out there) as reference work. I also occasionly look at solaufein. I've avoided Kesley (it seems to be the reason half these nifty command were added, so it would seem to be a bit over my head for now). I'm downloading Tashia now, its always nice to have something new to dissect.
/bt_igi                    

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Q: multi IF dependent says
« Reply #11 on: August 15, 2002, 08:54:18 PM »
The scope of 999999 is (loosely) "local to that script in your mod". So use 999998 for your next string (or whatever) but you can't possibly conflict with any other mod out there. Basically, WeiDU makes up a new string, appends it to your dialog.tlk, and then replaces 999999 in that one file with the number for the newly-created string.

If you're still confused about this, ask again and someone will explain it in more detail.                    

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #12 on: August 16, 2002, 12:22:58 PM »
No, I understand what your saying. All references are local to each mod, and weidu just appends them to the end of dialogl.tlk, and then fixes it so references in your mod point to the right place. Clever :)

I've run out of questions now, so thanks for the help!
/bt_igi                    

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #13 on: August 16, 2002, 12:26:57 PM »
Again, take a peek at Tashia. You just assign a nonsense value (99999 has become popular, though) and tell the TP2 script to replace it. Obviously, you need each value to be unique, so 99990, 99991, 99992, etc. so that each one only gets replaced once.                    
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #14 on: August 28, 2002, 12:11:21 PM »
Hiya,
Come back to this thread to extend my question.
My latest project is getting a sword to display a string when its equipped (ie. equip sword, text displays). The sword is made, the text is written, but linking the two...
The sword is set to display reference 999999. In the tp2 file, I've used
REPLACE ~999999~ ~My Text~
but it doesnt seem to work. When the sword is equipped the character name appears, but where the text should be is empty.
Looking at mymod.tp2, it says REPLACE can be used ot patch ASCII numbers in any file. I dont think the reference in the .itm file shows as ASCII, so is this option ruled out?
However, also looking at mymod.tp2, I think it could be possible using SAY XXX (line 69ish), but I dont know the XXX offset. Maybe if I changed the item to display reference 111111 and compared the files, found the offset of the difference and used that as the patch offset?
Hope someone can understand my question
/bt_igi                    

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #15 on: August 28, 2002, 12:39:24 PM »
Show a larger portion of your TP2 code.

What you want to do is something like

COPY ~scriptsource~ ~override\scriptdest~
REPLACE ~999999~ ~Your text~

                   
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #16 on: August 28, 2002, 01:06:27 PM »
The part of the tp2 that pertains to the item:

Code: [Select]
COPY    ~item/iissw03.itm~      ~override/iissw03.itm~
REPLACE ~999999~ ~As you take hold of the sword in your hand, you hear a disembodied voice laughing, and a sense of imminent danger takes hold of you~

  SAY NAME1 ~Short Sword~
  SAY UNIDENTIFIED_DESC #6747

  SAY NAME2 ~Magic Short Sword ~
  SAY DESC ~A magic short sword~

/bt_igi                    

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Q: multi IF dependent says
« Reply #17 on: August 28, 2002, 02:49:31 PM »
Someone who knows more about item editing is going to have to address whether what you're doing is sensible. I don't know if there is or isn't a field inside an .itm that displays a string when you pick it up.                    
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #18 on: August 28, 2002, 04:25:37 PM »
Well, there is an effect you can have on items that displays a string, and you can set it to happen when the item is equipped.
The .itm file stores the number of the string to display (the strref, i think it is called).
So, I guess it should be possible to patch the .itm file with the new offset, if I knew what offset weidu was giving my new string (or, a better way, figure out weidu enough to get it to do it for me).
(ummm... that still means I am looking for help if someone has any bright ideas :)
/bt_igi                    

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Q: multi IF dependent says
« Reply #19 on: August 28, 2002, 05:57:28 PM »
Quote
Hiya,
Come back to this thread to extend my question.
My latest project is getting a sword to display a string when its equipped (ie. equip sword, text displays). The sword is made, the text is written, but linking the two...
The sword is set to display reference 999999. In the tp2 file, I've used
REPLACE ~999999~ ~My Text~
but it doesnt seem to work. When the sword is equipped the character name appears, but where the text should be is empty.
Looking at mymod.tp2, it says REPLACE can be used ot patch ASCII numbers in any file. I dont think the reference in the .itm file shows as ASCII, so is this option ruled out?
However, also looking at mymod.tp2, I think it could be possible using SAY XXX (line 69ish), but I dont know the XXX offset. Maybe if I changed the item to display reference 111111 and compared the files, found the offset of the difference and used that as the patch offset?
Hope someone can understand my question
/bt_igi
                   If you're patching the sword ITM file, you really want to use SAY (yeah, these are arbitrary).

Use Near Infinity to find the Offset.
                   

bt_igi

  • Guest
Q: multi IF dependent says
« Reply #20 on: August 29, 2002, 12:13:24 PM »
Thanks for the reply Weimer.
[EDIT:] sorted it... just put the ~new text~ in... no need for a number. What a wonderfully magical piece of software :) [/EDIT]
Sorry for all the question btw, and thank for the replies
/bt_igi                    



[!--EDIT|bt_igi|Aug 29 2002, 11:58 PM--]

 

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)?: