Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Textshadow serverside? (https://forums.graalonline.com/forums/showthread.php?t=71647)

JkWhoSaysNi 01-24-2007 02:23 AM

Textshadow serverside?
 
Hello, I've made a simple function which creates some text in the format I'm using:

PHP Code:

function puttext(id,imx,imy,font,style,text,vis) {
  
showtext(id,imx,imy,font,style,text);
  
changeimgvis(id,vis);
  
changeimgzoom(id,0.5);
  
findimg(id).textshadow true;
  
findimg(id).shadowcolor = {0,0,0};
  
findimg(id).shadowoffset = {2,2};



I'm supplying it with ids less than 200 so the text appears to all players.

The text appears fine, however the shadow only appears on the client who created the text. Everyone else can see the text but not the shadow.

Is textshadow supported serverside?

Thanks.

Chandler 01-24-2007 09:30 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1268137)
Hello, I've made a simple function which creates some text in the format I'm using:

PHP Code:

function puttext(id,imx,imy,font,style,text,vis) {
  
showtext(id,imx,imy,font,style,text);
  
changeimgvis(id,vis);
  
changeimgzoom(id,0.5);
  
findimg(id).textshadow true;
  
findimg(id).shadowcolor = {0,0,0};
  
findimg(id).shadowoffset = {2,2};



I'm supplying it with ids less than 200 so the text appears to all players.

The text appears fine, however the shadow only appears on the client who created the text. Everyone else can see the text but not the shadow.

Is textshadow supported serverside?

Thanks.

I think you answered your own question^^
However, what is it that you're trying to show? Would it be anything directly connected to the player? If yes, use an attribute with a gani attached.

JkWhoSaysNi 01-24-2007 03:53 PM

I have to use a gani to attach text to a player for all to see?

It's easier for me just to create another text image and place it offset from the first :P

Chandler 01-24-2007 05:15 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1268395)
I have to use a gani to attach text to a player for all to see?

It's easier for me just to create another text image and place it offset from the first :P

That's if you only wanted for yourself to see it ;)

konidias 01-24-2007 07:12 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1268395)
It's easier for me just to create another text image and place it offset from the first :P

It still wouldn't show serverside. The reason being that images (including showtext) cannot display serverside in less than half tile intervals. (.5) Which means you can't place a serverside graphic at like -2.2 of a player and have it display.

I believe this is done to prevent lag or something. I really don't know.

edit: also before you point out that your shadowoffset is 2,2... it's because shadow offset goes by pixel. so it's more like +.2,+.2 which again, won't display serverside :)

Admins 01-24-2007 09:35 PM

The best way to display such things is using attr[] - you can put scripts and variables in there.
The serverside sendtext() has just been added recently, the findimg() function is working but the variable that is returned currently doesn't have any attributes. Recent attributes like textshadow is not working for showimgs/findimgs below index 200 anyway - you should use attr[] instead because it is simple to use and gives unlimited possiblities.

JkWhoSaysNi 01-24-2007 11:11 PM

I can't find any examples of attr[] usage.

Should I just use

player.attr[1] = findimg(id) ?


It doesn't seem to work. I'm using indexes over 200 and nobody can see text from anyone else.

Chandler 01-25-2007 10:14 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1268705)
I can't find any examples of attr[] usage.

Should I just use

player.attr[1] = findimg(id) ?


It doesn't seem to work. I'm using indexes over 200 and nobody can see text from anyone else.

I'd use them above 3, as attr[1] is the hat, attr[2] is the shield and attr[3] is the head of the player. I'd place it on something like attr[9], or work your way up from three.

Chompy 01-25-2007 03:48 PM

Quote:

Originally Posted by Chandler (Post 1269166)
I'd use them above 3, as attr[1] is the hat, attr[2] is the shield and attr[3] is the head of the player. I'd place it on something like attr[9], or work your way up from three.

attr[2] isn't the shield, and attr[3] isn't the head of the player :]

They are listed in the player. vars
(player.headimg, player.bodyimg)

napo_p2p 01-25-2007 09:08 PM

Quote:

Originally Posted by Chompy (Post 1269204)
attr[2] isn't the shield, and attr[3] isn't the head of the player :]

They are listed in the player. vars
(player.headimg, player.bodyimg)

Still, I would probably use higher attr values because attr[2] and attr[3] are commonly used by ganis.

Chandler 01-25-2007 09:11 PM

Quote:

Originally Posted by Chompy (Post 1269204)
attr[2] isn't the shield, and attr[3] isn't the head of the player :]

They are listed in the player. vars
(player.headimg, player.bodyimg)

Ah yes, I am mistaken!
HTML Code:

DEFAULTHEAD head19.png
DEFAULTBODY body.png

I was doing gani's the other day too, slipped my mind! Thanks :)

JkWhoSaysNi 01-25-2007 09:53 PM

I tried putting it in attr[9]

Still only the person who's clientside script created the image can see it.

Should I use IDs below 200?

xXziroXx 01-25-2007 11:06 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1269325)
I tried putting it in attr[9]

Still only the person who's clientside script created the image can see it.

Should I use IDs below 200?

Of course, otherwise its clientsided (unless the image is shown serverside).

JkWhoSaysNi 01-25-2007 11:46 PM

I've tried with indexes less than 200, the text shows but the shadow doesn't.

Admins 01-26-2007 01:46 AM

Like I said the new attributes like textshadow are not sent. You need to use attr[] and gani scripts, like
PHP Code:

player.attr[1] = "myscript.gani";
player.attr[2] = "mytext"

And in the myscript.tgani you put something like this:
PHP Code:

SCRIPT
function onPlayerEnters() {
  
with (findimg(200)) {
    
player.x;
    
player.y;
    
text player.attr[2];
    
textshadow true;
  }
}
SCRIPTEND 

That gani script is executed on each client, so everyone will see it.

JkWhoSaysNi 01-26-2007 02:16 AM

ah, i see.

Thanks :)

Rapidwolve 01-26-2007 03:32 AM

Wait so I'm a little confused attr[] can be used outside of gani's?

so for example:
PHP Code:

player.attr[1] = showtext(); //with valid params and arguments 

is valid?

xXziroXx 01-26-2007 03:36 AM

Quote:

Originally Posted by Rapidwolve (Post 1269533)
Wait so I'm a little confused attr[] can be used outside of gani's?

.. of course. They could back in gs1 aswell.

JkWhoSaysNi 01-26-2007 08:21 PM

is there any way to call a function from a gani?

I tried:

player.attr[2] = "my.gani";
player.attr[2].te****nction();

te****nction is declared as public in the gani. Is there any way to do this?


Also, doing as Stefan suggests and using with (findimg(200)) { (i had to change it to findweapon("name").findimg(200) for it to work)...

I have many people with this text attached to them, every time the action is triggered it updates them all, even though I only want it to update the text for the player that triggered it and not everyone elses.

zokemon 01-27-2007 09:13 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1269852)
is there any way to call a function from a gani?

I tried:

player.attr[2] = "my.gani";
player.attr[2].te****nction();

te****nction is declared as public in the gani. Is there any way to do this?


Also, doing as Stefan suggests and using with (findimg(200)) { (i had to change it to findweapon("name").findimg(200) for it to work)...

I have many people with this text attached to them, every time the action is triggered it updates them all, even though I only want it to update the text for the player that triggered it and not everyone elses.

What is the point? From what it sounds like you are explaining, there is a much easier way to do this.

Chompy 01-27-2007 05:07 PM

you can even use triggerserver(); in gani scripts, so I think functions should work to?

Chandler 01-28-2007 04:05 PM

Quote:

Originally Posted by Chompy (Post 1270214)
you can even use triggerserver(); in gani scripts, so I think functions should work to?

You can? Why would you want to?

Chompy 01-28-2007 10:34 PM

Quote:

Originally Posted by Chandler (Post 1270602)
You can? Why would you want to?

Why? Maybe for one-use gani scripts maybe?
I just said it because it works :]


All times are GMT +2. The time now is 12:24 AM.

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