Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   show image in player chat (https://forums.graalonline.com/forums/showthread.php?t=134256698)

sssssssssss 10-28-2009 03:18 AM

show image in player chat
 
So, is there a way to do this?

TSAdmin 10-28-2009 03:36 AM

Not using the default chat system, no. You'd have to completely script your own chat system in order to make changes to your liking, but I can imagine it being entirely possible to implement images in a custom chat system.

At first I wasn't quite sure why anyone would want to put images in chat, but I figure if it's not fully controlled by the player as to exactly what image is used, and when, then I could see something like a scripted chat system where emoticons like :) and :D are shown when their respective character combinations are entered.

sssssssssss 10-28-2009 04:32 AM

k, we do have a chat system, somewhat. Just curious how you could bring up an image in anything like that though. I guess just a showimg?

Switch 10-30-2009 03:05 AM

Yes. Stop the text where you show the image, then start again at the end of it's width (plus a space or so), and make sure you get enough room on top/bottom of it.

DustyPorViva 10-30-2009 03:18 AM

I think something like this is way past your capabilities.

sssssssssss 10-30-2009 03:45 AM

Its just showing a 0 where the image should be. If someone could tell me how to use setimg, or something else in this to show it up please. It's not regular chat, we're using bubbles and chat, so its all getting redrawn. help :(

PHP Code:

     temp.filters = { 
    { {
":)"":-)""=)""=-)"}, newsmilie_noob.gif}, 
  }; 
  
temp.chat player.chat.tokenize();

  for (
temp.itemp.chat){
    for (
temp.ftemp.filters){
      for (
temp.gtemp.f[0]){
        if (
temp.== temp.i.lower()){
          
temp.faceImage temp.f[1];
          
temp.chat.replace(temp.ctemp.faceImage);
        }
      }
    }
    
temp.c++;
  }
  for (
temp.ctemp.chat){
    
temp.newChat @= temp." ";
  }

  
player.chat temp.newChat


Switch 10-30-2009 09:34 PM

Quote:

Originally Posted by sssssssssss (Post 1534999)
Its just showing a 0 where the image should be. If someone could tell me how to use setimg, or something else in this to show it up please. It's not regular chat, we're using bubbles and chat, so its all getting redrawn. help :(

PHP Code:

     temp.filters = { 
    { {
":)"":-)""=)""=-)"}, newsmilie_noob.gif },
  }; 


It's still a string.
And besides, you're not doing any showimg(), changing the text x/y, etc.

sssssssssss 11-01-2009 01:32 AM

I know. I tried setimg in a few places but it didn't work. I was trying to ask where it should go in there, because I can't figure it out.

Switch 11-01-2009 02:59 AM

As said before, you should really use a custom chat system for this.

sssssssssss 11-01-2009 03:16 AM

Quote:

Originally Posted by sssssssssss (Post 1534999)
It's not regular chat, we're using bubbles and chat, so its all getting redrawn. help :(

Hence, a custom chat system.

Switch 11-01-2009 03:51 AM

Quote:

Originally Posted by sssssssssss (Post 1535459)
Hence, a custom chat system.

Didn't see that.

Find the text's width, place it correctly, show the image, find the text after's width, place it correctly, if there's another image show it, etc.

sssssssssss 11-01-2009 08:45 AM

Well what Im confused on is where to show the image. In the code above, I have it break up the players chat, then replace it with the array[1] in the list for any chat in array[0]. The only problem im having is trying to figure out where a showimg would fit in and work first, then Ill work on resizing it. Any ideas?

LoneAngelIbesu 11-01-2009 06:39 PM

I'm not sure why you need to be finding the width of the text. Split apart the input for every emoticon. Add the first part of the text. Display the emoticon. Add the rest of the text with x=imagex+imagewidth+spacer.

Switch 11-01-2009 08:41 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1535555)
I'm not sure why you need to be finding the width of the text. Split apart the input for every emoticon. Add the first part of the text. Display the emoticon. Add the rest of the text with x=imagex+imagewidth+spacer.

Personal preference/knowledge, I guess. I've never really worked with a custom chat system so it just made sense to me that way.

DustyPorViva 11-01-2009 09:02 PM

Only problem is you just can't insert an image in any sort of chat system, custom or not. You'd have to compile the text and images separately. That means for each player you'd have an image for text, then a smiley, then text, then two smileys, then text again and so on. That could ramp up the image count really fast, and even custom chat systems with just text can be pretty laggy as it is.

LoneAngelIbesu 11-01-2009 09:14 PM

Dusty speaks the truth.

You could probably do something along the lines of replacing the emoticon text with spaces and placing the emoticon between those spaces as a separate showimg. That would require a lot of testing, to get the coordinate placement correct. It's not really worth it, imo.


All times are GMT +2. The time now is 07:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.