Author Topic: MODULE: Hypertext v1.3 - Change font mid-sentence, web-like pages, Speech bubble  (Read 7399 times)  Share 

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Re: MODULE: Hypertext v1.21 - Change font mid-sentence
« Reply #20 on: 11 Mar 2008, 12:17 »
Kill me for digging this but it's very important if someone cares to use it for AGS 3.0

First if new-strings is set to true it means that you have to replace a lot of functions in the module. 780 lines is a lot..
Yes, this module only works in AGS3.0+ if you turn of the strict settings, to allow the old RawDraw functions to work. Upgrading my modules to 3.0 is on my todo list!

Quote
Secondly when you add pages you have to make sure that the line of code isn;t bigger than 500.

Yes, AGS scripts have a line length restriction, but you can Add to the same page repeatedly and the new text gets added to the end.

Quote
Don;t do this:
Hypertext.Add("mypage","Get dead really
fast.");

Yes, AGS doesn't allow newlines in strings, but you can use the "[" character, like in normal AGS speech to insert a Line Break

Quote
Also the name of a page shouldn't contain any gaps for your personal convinience.You can;t link it like this _my page|more_.

Page names can contain gaps, but not when used with aliased links like you say. This isn't easy to workaround given the current code. If you want to use a lot of aliased links, try using underscores, dots, or CamelCase in your page names, instead of spaces.

Quote
Also leave a gap before each _ and after one_
ex:
Get dead or what _my page_ .
Or put the full stop inside the '_'s

Quote
If you don;t folllow my advice you'll get a message I got. AGS failed in drawing... and some stuff.

If you get an error, you can post it here and I can sort out the problems! But vague references don't really help!
« Last Edit: 11 Mar 2008, 12:24 by SSH »

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Bumped for new version: now works in AGS 3.0 wihtout any faffing about, and should also be a bit faster.

Dualnames

  • Local Moderator
  • Dualnames worked on a game that was nominated for an AGS Award!
Damn , you. Did you have to wait for me to make 56 pages to change it?

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
But you can just remove the current module and load in the new one. It shouldn't change the pages you've made at all.

Hi
thanks for your work :)

I tried to use your module to have speech in bubble.
I have copy/paste example code in a room script(after fadein).
no error at compile time but not bubble although.

Could you please explain how to do this?
I read documentation and this thread but cant manage to understand how to do.

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Please post the code you used and teh AGS version you are using. Also, try putting some other code (e.g.a Display) in the function to make sure it is working.

Im using 3.01 final

I just copy/paste this code from demo game

[code]
function room_AfterFadeIn()
{
Hypertext.SetPrefixStyle(HYPERTEXT_NORMAL, 4, eHypertextSpecial_None, 0, 0, 0);
Hypertext.SetPrefixStyle(HYPERTEXT_LINK, HYPERTEXT_KEEP, eHypertextSpecial_Underline, 240, 0, 40);
Hypertext.SetPrefixStyle(HYPERTEXT_VISITED, HYPERTEXT_KEEP, eHypertextSpecial_Overline, 180, 40, 0);
Hypertext.SetPrefixStyle('=', 8, eHypertextSpecial_Box, 0, 0, 0);
Hypertext.SetPrefixStyle('^', HYPERTEXT_KEEP, eHypertextSpecial_Strikethrough, 255, 255, 255, 0,60,0);
Hypertext.SetPrefixStyle('*', 4, eHypertextSpecial_Bold);
Hypertext.SetPrefixStyle('/', 6);
Hypertext.SetPrefixStyle('+', 7, eHypertextSpecial_Crossout); 
Hypertext.SetPrefixStyle('_', 3, eHypertextSpecial_None, 255, 0, 0);
Hypertext.SetBubbleColour(255, 255, 255, 0, 0, 0);
Hypertext.SetBubble(3, 3, 8, 5, 5, 5);


player.Say("hello");
}
[/code]

I notice that in demo game code is in hotspot interaction.
Is it mandatory?


Thanks for your answer :)

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
You need to use:

[code]
Hypertext.Say(player, "Hello")
// not player.Say...
[/code]

Thanks 
I now have speech in bubble, however bubble appears top of the screen instead above character head.

My game is 800x600 32bits colour depth direct 3d 9 graphics driver

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
What speech mode have you set? Sierra? Lucasarts?

Its Lucasart.
But its the same thing with other mode.
bubble appears on top of the screen

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
What are the X and Y coordinates of your player character?

I have 2 characters

first x=140 y=209

second  x =177   y=209

 i just use this code in after fadein

[code]
Hypertext.SetPrefixStyle(HYPERTEXT_NORMAL, 1, eHypertextSpecial_None, 0, 0, 0);
Hypertext.SetBubbleColour(0, 0, 0, 255, 255, 255);
Hypertext.SetBubble(3, 3, 8, 5, 5, 5);
[/code]




SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Can you upload a sample game?

Dualnames

  • Local Moderator
  • Dualnames worked on a game that was nominated for an AGS Award!
I actually have lucas arts style and it;'s working good. You probably haven't set the module's settings to work the right way.

Quote
You probably haven't set the module's settings to work the right way.
yes  thats all my problem I guess.

Can you give me an example of a proper setting?

EDIT
ok problem solved.
It was caused by scaling level.

SSH will give us a fix soon :)
« Last Edit: 12 Apr 2008, 13:20 by riseryn »

Dualnames

  • Local Moderator
  • Dualnames worked on a game that was nominated for an AGS Award!
well, I'm replying either ways. There's a part at the module script(asc) that has at the function game start a list of setting for the Hypertext. Which are default if you don;t put your own.

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
The problem was that I didn't take scaling into account in calculating where "above a character" was, so when a character was scaled down small, like riseryn's, the module placed the text above his head as if he were unscaled, meaning a huge gap. Its an easy fix, but I ain't got the code on this computer easily to hand.

Sorry for bumping this, but I've been fiddling around with the demo-game and re-reading the documentation but I'm not sure how to deal with this (seemingly basic) question:

How can you call a function after a user has clicked on a specific hypertext link?

I've got the pages set up on a GUI button, that the player needs to click through; once they reach the relevant entry, I need to add an inventory item.  As you call all the Hypertext pages with the 'Add' function at the room load, I'm not sure what you'd use to indicate exactly when a user has reached the right link? I'm sure it's straight-forward but I've hit a stumbling block as a beginner. 

Any help appreciated :)

So it is not possible to display bubble over "player.say()" ?

This could be usefull module, but i have a lot of text already written. I don't want to go back and rewrite it all (i am too lazy!).