Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-01-2009, 07:57 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-01-2009, 08:14 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Well player.ap started magically working now. Still wondering how to show the img in the order i need on the screen.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #3  
Old 12-01-2009, 08:16 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by sssssssssss View Post
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);
Reply With Quote
  #4  
Old 12-01-2009, 08:17 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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);

__________________
Quote:

Last edited by fowlplay4; 12-01-2009 at 10:31 PM..
Reply With Quote
  #5  
Old 12-01-2009, 08:18 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by fowlplay4 View Post
but the GS2 way is using findimg
Bull****. Both findImg() and showImg() are valid GS2.
Reply With Quote
  #6  
Old 12-01-2009, 08:19 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by fowlplay4 View Post
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 ^
Reply With Quote
  #7  
Old 12-01-2009, 08:21 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Oh.
ty.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #8  
Old 12-01-2009, 08:25 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #9  
Old 12-01-2009, 08:39 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by sssssssssss View Post
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))); 
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #10  
Old 12-01-2009, 08:41 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
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.
Reply With Quote
  #11  
Old 12-01-2009, 08:48 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Crow View Post
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;
  }

__________________
Quote:
Reply With Quote
  #12  
Old 12-01-2009, 09:24 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by fowlplay4 View Post
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 :/
Reply With Quote
  #13  
Old 12-01-2009, 10:13 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Codein View Post
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.
__________________
Quote:
Reply With Quote
  #14  
Old 12-01-2009, 10:17 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by fowlplay4 View Post
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?
Reply With Quote
  #15  
Old 12-01-2009, 10:33 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Fair enough, edited my post above.
__________________
Quote:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:25 AM.


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