SphereCommunity
Dialog on item? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Dialog on item? (/Thread-Dialog-on-item)



Dialog on item? - tleilax - 02-07-2018 08:06 AM

Hello,
we are trying to move from 55i to 56d and we are having trouble with our very very customized player vendor system.

I identified what is causing the problem:
Code:
on=*buy*
FINDID.i_vendor_tag_box.DIALOG d_vendor

The i_vendor_tag_box is the vendor's container in which the items for sell are stored. So basically we used to open a dialog on vendor item and showed it to player.

Later in that dialog we could use something like this:
Code:
<FINDCONT.0.NAME> //name of the first item for sale
<SRC.NAME> //name of player who opened the dialog

Since this no longer works on 56d for some reason, what would be the best way to fix this problem? Store the "i_vendor_tag_box" UID as OBJ? Anything easier so I don't have to rewrite most of the 7000 lines of code?

Thank you.


RE: Dialog on item? - x77x - 02-07-2018 12:07 PM

speech file?

Code:
ON=*ogre cock*
        SAY=That's correct!
        BUY

ON=*buy*
        SAY=Sorry! Can't help you... You gotta know the password...    
    RETURN 1

Code:
ON=*buy*
DIALOG d_somedialog
RETURN 1



RE: Dialog on item? - tleilax - 02-08-2018 02:38 AM

I think I already provided my speech file, at least the important part:
Code:
on=*buy*
FINDID.i_vendor_tag_box.DIALOG d_vendor

This is part of the speech of the vendor. When the vendor hears *buy*, the dialog "d_vendor" starts on container named "i_vendor_tag_box", which is inside the vendor (topboj = c_vendor).
Then inside the dialog script, you can do:
Code:
<uid> //uid of the i_vendor_tag_box - item which started the dialog
<src.uid> //uid of the character that said "buy"
<topobj.uid> //uid of the vendor



RE: Dialog on item? - darksun84 - 02-08-2018 03:41 AM

If i understand well, the dialog appears on SRC, but the values <uid>/<topobj>/<src> are wrong right?


RE: Dialog on item? - tleilax - 02-08-2018 03:48 AM

Yes dialog is correctly displayed to <src> (player), but <uid> and <topobj> are wrong.


RE: Dialog on item? - darksun84 - 02-08-2018 04:37 AM

What are the values of <uid> and <topobj>? Are the same uid of <src>? You need to print / log them in the dialog so we can check what object <uid> and <topobj> are referring


RE: Dialog on item? - tleilax - 02-13-2018 05:49 AM

I did some more testing and seems like I was wrong, the problem is somewhere else. The previous works the same, I was just outputting the UIDs wrong *facepalm*.

Anyway, we use dynamic paging in dialog to check if to show some dialog elements (like buttons or text) or not, like this:
Code:
[dialog d_vendor]
page <eval <findcont.0.isitem>>
text 320 50 0 2

Basically, if there is item in "slot 0", we want to display the text, otherwise not. This doesn't seem to work on 56d, but worked on 55i. Any ideas?


RE: Dialog on item? - darksun84 - 02-13-2018 06:43 AM

You can use IF inside dialogs in 56 versions, i don't remember in 55?

But the line of code above will just render page 0 or 1, but page 0 is always rendered because it's the "background" right?


RE: Dialog on item? - tleilax - 02-13-2018 06:46 AM

The code was just for the idea, actually it renders "page -1" when elements shouldn't be available and "page 0" when they should (it's more like <eval <findcont.0.isitem>-1>).

How would you rewrite it with IF conditions? Won't I screw up my text line numbers? I don't want to convert it to dtext Sad

But I guess if I want to make it work with IF conditions, I need to completely remove the [dialog d_vendor text] and make all texts into dtexts, right...


RE: Dialog on item? - tleilax - 02-13-2018 07:53 AM

Alright, I changed everything to dtext and added if conditions for paging, now everything seems fine. A lot of work to do, but it works, thanks.