Scrolling Dialog Template -- DEPRECATED

Started by monkey0506, Thu 30/12/2004 21:17:11

Previous topic - Next topic

monkey0506

This template is officially deprecated.  I would suggest using the ScrollingDialog script module, which is its replacement, found here.  Thank you.

ATTENTION:

This template was designed within and for AGS Version 2.62.  It is now outdated, although it's replacement is still under construction.  It was never fully implemented, but the missing features are getting worked on in the Script Module that will replace this template.  You are still free to use this as you see fit, but as I now use AGS 2.7 support may (and probably will) be limited!

--

I've been waiting a long time for scrolling dialogs to get off of the AGS tracker, but it's still there. So, I got bored and did it myself (a.k.a. I promised authenticity, and I'm pretty anal about it). I want to thank those who helped me with label-clicks and multidimensional arrays.

Things to note:
If you download the template, make sure you do not change these settings
1. This is entirely script-based and does not use AGS's built in dialog interface.
2. This script is customized for a 7 label GUI "DIALOG" that display the text for the dialog.
3. Customized for a 2 button GUI "DLGARROWS" with arrows that turn off if you can not scroll in that respective direction.
4. With the current script you can not have text that spans longer than 1 line.
5. DIALOG and DLGARROW GUIs MUST be normal GUIs not pop-up modal.
6. The "dlg" struct is contained in the header file.  I'm not sure if it can be moved, but that is where it's at.
7. I wrote this script, so if it's not too much to ask, I'd like some credit.

Now that that's said and done, the script:

[EDIT: See latest script here.]

;D Michael Rittenhouse

Last edit:  13 March 2005
Local time (at edit):  5:20 P.M.

(Edited by strazer to add first note)

Rui 'Trovatore' Pires

Any chance of templatizing it? I could upload it then. And I could see this going into the archive...

(But by all means, CJ, don't let this workaround postpone the much awaited feature. ::) )
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Ponch

 :o

Wow! That is amazing!

I'll have to give that a try in a game.

Thank you for sharing that code.

monkey0506

#3
 ;D I'm glad you guys like it. But please test it, as I customized the scripts for my game and copied/pasted/edited it for the post. I may have missed something, and be sure to test it for bugs. I still can't believe that I coded all that. I did have some help with label clicks and strazer showed me how to set up the struct (thanks guys ;D) but I still can't get over the feeling that I did this. Well, like I said, have fun. I figure that this is fairly customizable as it's entirely script based. If you need any help, just ask and I'll try to figure out why this thing works...

EDIT:

Quote(But by all means, CJ, don't let this workaround postpone the much awaited feature.Ã,  ::) )

By the way, I would like to hear CJ's comments on this "workaround". ;D

EDIT: I don't know about a template. I guess I could make one... ::) I'll get to it eventually. That will give me an excuse to not be working on my game (all I need now to release the first demo is to finish the graphics :P).

Rui 'Trovatore' Pires

Ok. Just be sure to tell me if you DON'T templatize it, because in that case I will. ;)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

monkey0506

#5
I have found a problem with my script. It only allows for the text to be one line long. I'm looking into fixing this at the moment. I'll let you know if I get it figured out.


EDIT:

I've tried using something like:

Code: ags
if ((StrLen(text) * MAXFONTWIDTH) > DIALOGGUIWIDTH) {
Ã,  SetLabelText(DIALOG, (line + 1 + shift), "");
Ã,  line++
Ã,  }


There's more to what I actually tried, but that's the basic idea of what I tried. It didn't work.

1. I changed the label that certain text would appear on, so that would produce errors with RunCustomDialog.
2. Some lines which didn't overflow the first line graphically did mathematically.
3. The second line of an option is shifted down from where it should appear.

So, I tried using an average of the smallest width and the largest width used by the font. It produced the same errors. I don't want to use the smallest width (which for my font is 1 pixel) because that would definitely produce errors (You could have 200 "i"s at 200 pixels (one line), but 200 "M"s would be 1600 pixels (over 4 lines) with the font I'm using.) So, unless I manually store and test the width of every character in the string, I don't see how multi-line text is going to be possible here. And I don't know about your fonts, but mine has 89 characters, so (manually, as in, USER DEFINED) storing that many variables isn't logical for this matter. Perhaps this "work around" will inspire Chris to finish the AGS implemented version so we can have multi-line text, but untill then, I suggest keeping it to one line (unless one of you have an idea(?)).

EDIT:

You know, this also serves as a work-around for some other problems with the dialogs:

Custom-defining the highlight color.
Animating objects/characters/backgrounds/etc. while choosing a dialog option.

But I guess you have a choice. You can get these three things, or you can get multi-line dialog options. I'd probably have to choose the scrollability over the multi-line(ity)...

Pumaman

Very clever, your own dialog system, pretty much :)

Anyway yes, the dialog options changes are still on my to-do list, but I've got other things to concentrate on for 2.7 so this workaround is good for a while at least :)

monkey0506

Sweet! Two "smiley" smileys! Thanks for the compliments Chris! ;D I was at a friend's house most of the weekend, and I have to start going back to school tomorrow (4 Jan) so I'll work on templatizing this, but it could take me a while...

Mr Flibble

Wow Michael, I underestimated you. Bravo!
Ah! There is no emoticon for what I'm feeling!

monkey0506

#9
I got Tech Archived! :o I can now die happy! ;D Thanks for all the positive feedback. BTW, I'm still looking for a way to provide multi-line text, so feel free to offer ideas. ;D

EDIT: By the way, the list of "things to note" in the first post has been updated, so if you haven't read it lately, go back and look over it again.

strazer

Yeah, although I haven't actually tested your code...
So hurry up with that template! ;)

monkey0506

#11
Just wondering, has anyone yet tested the code? I've still been contemplating perfection (multi-line text support), so I haven't actually started on the template yet. I don't suppose it would take me very long to make one, I just haven't done it yet. Ok... I think I'll do it now. I'm bored enough. ::)

YAY! I've made a template! Be warned though: I didn't take the time to make proper cursors, so they're really crappy. I used the empty template, and ripped the cursors from the Default template, and did a crappy job for it. The cursors are all large black squares with the pictures inside them. If it's really that important, I could re-install Photoshop (I didn't intentionally format the hard drive!) and fix the cursors to have a black outline, instead of a black square. (Hey, version 2.0? XD)

Have fun, and feel free to link the crap out of it. I don't even use this brinkster account any more:

http://www32.brinkster.com/monkey0506/csdlg.zip

Candle

The game crashed when I tried to talk to ego and gave this error .
---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.63.780)

Error: run_text_script1: error -6 running function 'character2_b':
Error (line 23): Array index out of bounds (index: -1, bounds: 0..8999)



Rui 'Trovatore' Pires

I'll upload the template in my resource site as soon as it's bug proof, yes? (reference to Candle's post) ::)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

strazer

Which version of AGS was the template made with?
It doesn't show up for me in either AGS 2.62 or 2.7 Beta 10. Please try giving the file a shorter name when creating it.

monkey0506

#15
I used AGS 2.63 when I made it... I didn't realize making the name long would cause problems, but I'm having problems getting it to show up too. I did get it to show up once last night (after quite a few tries), so I figured maybe it was just my computer... Ok, I got it now, I'm not sure exactly how, I just kept trying. I'll try making the new template with a shorter name (after I try to figure out Candle's apparent bug). BTW, the script in the template will actually be better than that which I posted, because I did find some run-time errors there, and thought I had fixed all of them. I made the script in my game, so it was tricky picking it all out. I'll take a look at that now, and update you on any news.

Ok... I lied, it was made with 2.62... I could've sworn I had 2.63 installed... BTW, I don't know why it would say that there was an array out of bounds. For one, 'character2_b' isn't on line 23, and I checked, and line 23 contains no array element... I'm going to re-upload the template... Let me know if you still have problems. BTW, renaming it appears to have fixed the problem with "it [not] show[ing] up" (strazer), as it appears on the new game list every time I try it now...

Candle


monkey0506

I don't know what the problem is. ??? This is beginning to get frustrating. If someone can give me their email, I'll try sending them an unzipped copy of the template, and see if they can get it to work that way. Otherwise, the only thing I can think to suggest would be to dowload PicoZip and try using that to open the zip file. That's what I used to compress it, and when I opened the file (off of the link) just now, it worked fine. ???

Candle

Here is the file that monkey sent to me so if someone gets a bad zip on the one linked here you can try this one .
http://12.22.230.41/MicroTech/Host/Games/CustomScrollingDialog.zip
will be up for 60 days .

monkey0506

#19
Candle, you didn't comment on the template itself. Did you still get that error when talking to Roger?

EDIT: Candle emailed me:

QuoteWell ran it at 640 and it did the crash so loaded it again at 320 and
it didn't crash when I used the talk icon on ego . but it gives me the
a two line dialogue ?
Click on it with any ofÃ,  the other icons and it gives the scrolling dialogue .
but clicking on the top when and it quits the dialogue .
clicking any other oneÃ,  locks the mouse so can't change iconÃ,  to walk etc ..
It maybe my system ? but I will upload it and give link in your post
so someone else can try it .

I guess that for some reason you have to run the template at 320 resolution? As for the dialogs, there are two set up.

Dialog 0:
1. My name's Guybrush Threepwood. Prepare to die! (this one turns off after it is said)
2. So... How did you get up there? (use this to exit the dialog)
3. I'll just be running along now. (use this to exit the dialog)

Dialog 1: (8 messages just for testing -- This one should be scrollable. Use option 1 to exit the dialog.)

I also set it up so that the game does not respond to mouse-clicks or key-presses if you are running a dialog. That is why you can't change the cursor mode while running a dialog. You can change this in the global script, it's not a bug... It's just to emulate the paused interface of AGS's default handling. You can allow anything you want, I just disallowed anything for the template. And I just tested it on my computer in 640 X 400, and it didn't produce any errors. Perhaps it's Candle's computer? Can someone else verify either way. In any case I made a template from the 640 X 400 version (if that makes a difference).

http://www32.brinkster.com/monkey0506/dlg640.zip

Let me know if you get another bad zip so I can send the full file to someone via email (I can only upload 1 MB to the website). Oh... And something that (doesn't need to) but should be changed:

Code: ags
// interface_click
// if (button == 0)
else if (button == 1) { // scroll down
Ã,  optstate[DialogVariable(1)] = 1; // topopt = off;
Ã,  optstate[DialogVariable(2) + 1] = 0; // bottomopt + 1 = on;
Ã,  }
// SetupDialog


In interface click, the line that reads "optstate[DialogVariable(1)]" of the "else if" statement should appear before the line that reads "optstate[DialogVariable(2) + 1]". This is just to ensure that scrolling down does not produce errors (turning the bottom option + 1 on first could cause options which are not on to have their optstate[] set to 0 (on), which could cause problems later). Please notify me of any other bugs/(possible) errors that you find. :)

EDIT: In the two most recent versions of the template there is no function character2_b. I used the interaction editor, deleted all interaction, then put all the scripts (2) in the "any click" option. So is it now producing the error in function character2_a (which exists) or is it producing an error in a non-existant area of the script???

SMF spam blocked by CleanTalk