Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Player ap bar (https://forums.graalonline.com/forums/showthread.php?t=134257149)

sssssssssss 12-01-2009 07:57 PM

Player ap bar
 
PHP Code:

function onTimeout() {
  
temp.img "armageddon-bar.gif";
  
temp.img2 "armageddon-ap.gif";
  
showimg(200img2020);
  
changeimgvis(2004);
  
changeimgpart(20000, (player.ap 100) * getimgwidth(img), getimgheight(img));  
  
//showimg(201, img2, 19, 19);
  //changeimgvis(201, 4);
  
setTimer(0.05);


Trying to make a new bar for player ap. Using this, it does absolutely nothing, which is weird because
PHP Code:

player.hearts player.fullhearts 

works fine.

Also, img 201 is showing on top of img 200, is there a way to change this? Need 200 on top of 201.

sssssssssss 12-01-2009 08:14 PM

Well player.ap started magically working now. Still wondering how to show the img in the order i need on the screen.

Codein 12-01-2009 08:16 PM

Quote:

Originally Posted by sssssssssss (Post 1541705)
Well player.ap started magically working now. Still wondering how to show the img in the order i need on the screen.

Put one on layer 5. In your case:

changeimgvis(200, 5);

fowlplay4 12-01-2009 08:17 PM

Any layer 4 and over can be displayed, so you can do things like..

changeimgvis(200, 5);

but the FP4 way is using findimg like so:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
drawAPBar();
  
setTimer(0.05);
}

function 
drawAPBar() {
  
with (findimg(200)) {
    
image "armageddon-bar.gif"
    
20;
    
20;
    
layer 4;
  }
  
with (findimg(201)) {
    
image "armageddon-ap.gif";
    
20;
    
20;
    
layer 5;
  }
}

function 
onTimeout() {
  
// Adjust the image width here using changeimgpart or partw, parth variables.
  
setTimer(0.05);



Crow 12-01-2009 08:18 PM

Quote:

Originally Posted by fowlplay4 (Post 1541707)
but the GS2 way is using findimg

Bull****. Both findImg() and showImg() are valid GS2.

Codein 12-01-2009 08:19 PM

Quote:

Originally Posted by fowlplay4 (Post 1541707)
Any layer 4 and over can be displayed, so you can do things like..

changeimgvis(200, 5);

but the GS2 way is using findimg like so:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
drawAPBar();
  
setTimer(0.05);
}

function 
drawAPBar() {
  
with (findimg(200)) {
    
image "armageddon-bar.gif"
    
20;
    
20;
    
layer 4;
  }
  
with (findimg(201)) {
    
image "armageddon-ap.gif";
    
20;
    
20;
    
layer 5;
  }
}

function 
onTimeout() {
  
// Adjust the image width here using changeimgpart or partw, parth variables.
  
setTimer(0.05);



It's perfectly fine to use changeimgvis(200, 5); :P

EDIT: What Crow said ^

sssssssssss 12-01-2009 08:21 PM

Oh. :)
ty.

sssssssssss 12-01-2009 08:25 PM

Actually, one more question. Its probably just math, but I dont know.
Instead of it starting from top to bottom, is there a way to make it bottom to top?

PHP Code:

//#CLIENTSIDE
//Needs to show the this.apsbar on the complete left, like zelda hp, but for ap. 
//Needs to show the image armageddon-wepicon.gif beside new ap 
//bar, like zelda, and work with showing the wepicon image 
//in the center of it. example at:
//http://old-wizard.com/wp-content/uploads/2008/06/zelda_1.jpg

function onCreated(){
  
showStats(allstats 64 512 128);
  
with findImg2000 ) ) {
    
text "--- Life ---";
    
font "Arial";
    
style "bic";
    
zoom .8;
    
layer 4;
    
mode 1;
    
560;
    
15;
    
textshadow true;
    
shadowcolor = {010};
  }
  
drawAPBar();
  
onTimeout();
}
function 
drawAPBar() { 
  
with (findimg(200)) { 
    
image "armageddon-bar.gif";  
    
27
    
27
    
layer 5
  } 
  
with (findimg(201)) { 
    
image "armageddon-ap.gif"
    
20
    
20
    
layer 4
  } 

function 
onTimeout() {
  
temp.img "armageddon-bar.gif";
  
temp.img2 "armageddon-ap.gif";
  
changeimgpart(20000getimgwidth(img), (player.ap 100) * getimgheight(img));  
  
setTimer(0.05);



Tigairius 12-01-2009 08:39 PM

Quote:

Originally Posted by sssssssssss (Post 1541717)
Actually, one more question. Its probably just math, but I dont know.
Instead of it starting from top to bottom, is there a way to make it bottom to top?

PHP Code:

  changeimgpart(20000getimgwidth(img), (player.ap 100) * 


Yes, probably something like this:
PHP Code:

  changeimgpart(20000getimgwidth(img), getimgheight(img) - ((player.ap 100) * getimgheight(img))); 


Codein 12-01-2009 08:41 PM

Off the top of my head, here's how I'd do it:

HTML Code:

Subtract percentage of imageheight from imageheight, let this be part y;
Let percentage of imageheight equal part height.

Not sure if it'd work.

fowlplay4 12-01-2009 08:48 PM

Quote:

Originally Posted by Crow (Post 1541709)
Bull****. Both findImg() and showImg() are valid GS2.

I didn't say it wasn't. I personally like to see findimg, it's a little more flexible and looks better than doing:

PHP Code:

function comparison() {
  
// Showimg
  
showimg(200"block.png"2020);
  
changeimgvis(2004);
  
changeimgcolors(20010.500.5);
  
// Findimg
  
with (findimg(200)) {
    
image "block.png";
    
20;
    
20;
    
red 1;
    
green 0.5;
    
blue 0;
    
layer 4;
  }



Codein 12-01-2009 09:24 PM

Quote:

Originally Posted by fowlplay4 (Post 1541728)
I didn't say it wasn't. I personally like to see findimg, it's a little more flexible and looks better than doing

You shouldn't say "This is the GS2 way" against valid GS2 code then :/

fowlplay4 12-01-2009 10:13 PM

Quote:

Originally Posted by Codein (Post 1541738)
You shouldn't say "This is the GS2 way" against valid GS2 code then :/

Why? set(varname) is valid GS2 but that doesn't make it the GS2 way to do things.

Codein 12-01-2009 10:17 PM

Quote:

Originally Posted by fowlplay4 (Post 1541748)
Why? set(varname) is valid GS2 but that doesn't make it the GS2 way to do things.

It's deprecated. changeimgvis() has not be declared obsolete. It can be useful to use the function when setting values only once and such, since it's less to type. Both are perfectly acceptable.

It's my personal belief that you shouldn't be able to access TShowImg (or any object) members anyway. They should all have methods for that. We're using an Object-Oriented language which completely gives the finger to encapsulation. Wtf Stefan?

fowlplay4 12-01-2009 10:33 PM

Fair enough, edited my post above.


All times are GMT +2. The time now is 08:26 AM.

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