Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-08-2007, 05:58 PM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
GUI Problem

I got a basic layout for a GUI on graal.net snippets and edited it a little bit. Problem is is that when online, the GUIs overlap with everyone else in that level..... here is the script

Quote:
//#CLIENTSIDE
if (created || timeout) {
showtext 0,32,64,Arial,b,Health: #s(clientr.player_hp)/#s(clientr.player_maxhp);
showtext 1,32,80,Arial,b,Mana: #s(clientr.player_mp)/#s(clientr.player_maxmp);
showtext 2,32,96,Arial,b,Type: #s(clientr.player_type);
showimg 4,toguilightest.png,16,16;
showimg 5,#3,32,32;
showtext 6,72,48,Arial,bi,#e(0,13,#n)#s(this.nick);
showtext 7,16*17+8,48,Arial,br,Talik: #v(player.rupees);
showtext 8,16*17+8,64,Arial,br,Shield: #v(playershieldpower);
showtext 9,16*17+8,80,Arial,br,Weapons: #s(this.enabweap);
showtext 10,16*17+8,96,Arial,br,Lvl. Type: #s(this.zonetype);
changeimgzoom 0,0.6;
changeimgzoom 1,0.6;
changeimgzoom 2,0.6;
changeimgzoom 3,0.6;
changeimgzoom 6,0.6;
changeimgzoom 7,0.6;
changeimgzoom 8,0.6;
changeimgzoom 9,0.6;
changeimgzoom 10,0.6;
changeimgzoom 11,0.6;
changeimgzoom 12,0.6;
changeimgzoom 13,0.6;
changeimgvis 0,4;
changeimgvis 1,4;
changeimgvis 2,4;
changeimgvis 3,4;
changeimgvis 4,4;
changeimgvis 5,4;
changeimgvis 6,4;
changeimgvis 7,4;
changeimgvis 8,4;
changeimgvis 9,4;
changeimgvis 10,4;
changeimgvis 11,4;
changeimgvis 12,4;
changeimgvis 13,4;
changeimgpart 5,0,64,32,32;
changeimgcolors 0,1,0,0,1;
changeimgcolors 1,0,1,1,1;
changeimgcolors 2,1,1,1,1;
changeimgcolors 3,1,1,1,1;
changeimgcolors 6,0,1,0,1;
changeimgcolors 7,1,1,1,1;
changeimgcolors 8,1,1,1,1;
changeimgcolors 9,1,1,1,1;
changeimgcolors 10,1,1,1,1;
changeimgcolors 11,1,1,1,1;
changeimgcolors 12,1,1,1,1;
changeimgcolors 13,1,1,1,1;
if (weaponsenabled) setstring this.enabweap,Enabled;
else setstring this.enabweap,Disabled;
if (nopkzone) setstring this.zonetype,No PKing;
else {
if (issparringzone) setstring this.zonetype,Sparring;
else setstring this.zonetype,PKing;
}
showstats 1024;
timeout = 0.05;
}

Make it compatible online please!
Reply With Quote
  #2  
Old 04-08-2007, 06:00 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Oh god, first of all use GS2. Second your showtext and showimg index's should be atleast 200 to prevent other players from seeing it.

PHP Code:
//#CLIENTSIDE
function onCreated() onTimeout();
function 
onPlayerEnters() onTimeout();

function 
onTimeout(){
showtext(2003264"Arial""b"format("Health: %f/%f"clientr.player_hpclientr.player_maxhp));
showtext(2013280"Arial""b"format("Mana: %f/%f"clientr.player_mpclientr.player_maxmp));
showtext(2023296"Arial""b"format("Type: %s"clientr.player_type));
showimg(204"toguilightest.png"1616);
showimg(205player.headimg3232);
showtext(2067248"Arial""bi"player.nick.substring(013) @ this.nick);
showtext(207, (16*17+8), 48"Arial""br"format("Talik: %i"player.rupees));
showtext(208, (16*17+8), 64"Arial""br""Shield: " playershieldpower);
showtext(209, (16*17+8,80), "Arial""br""Weapons: " this.enabweap);
showtext(210, (16*17+8,96), "Arial""br""Lvl. Type: " this.zonetype);
for (
199250i++)
changeimgzoom(i0.6);

for (
199250j++)
  
changeimgvis(i4);

changeimgpart(2050643232);
changeimgcolors(2001001);
changeimgcolors(2010111);
changeimgcolors(2060101);

if (
weaponsenabledthis.enabweap "Enabled";
else 
this.enabweap "Disabled";
if (
level.nopkzonethis.zonetype "No PKing";
else {
if (
level.issparringzonethis.zonetype "Sparring";
else 
this.zonetype "PKing";
}
showstats(1024 256);
setTimer(.05);

Used the for() because I was lazy

Last edited by Rapidwolve; 04-08-2007 at 06:12 PM..
Reply With Quote
  #3  
Old 04-08-2007, 06:10 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Rapidwolve View Post
Oh god, first of all use GS2. Second your showtext and showimg index's should be atleast 200 to prevent other players from seeing it.
Don't push him, Jeez read my thread.


-------------------

Try indexes higher than 201 to make it visible to you but nobody else.
__________________
What signature? I see no signature?
Reply With Quote
  #4  
Old 04-08-2007, 06:36 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Here's what C' would do with that text stuff!

HTML Code:
//#CLIENTSIDE
function onCreated()
  {
  hideimgs(200, (200 + this.drawText.size()));
  this.drawText = {
  //{index, x, y, style, text, message, {colors}, layer, zoom}
    {200, 32, 64, "b", format(_("Health: %f/%f"), player.hearts, player.fullhearts), {1, 0.3, 0, 1}, 4, 0.8},
    {201, 32, 64, "bc", format(_("magic: %f/100"), playermp), {0, 0.3, 1, 1}, 4, 0.8}
  };
  for (temp.currentText: this.drawText)
    this.makeText(temp.currentText);
  }
function makeText(textData)
  {
  showText(temp.textData[0], temp.textData[1], temp.textData[2], "Arial", temp.textData[3], temp.textData[4]);
  changeimgvis(temp.textData[0], temp.textData[5]);
  changeimgcolors(temp.textData[0], temp.textData[4][0], temp.textData[4][1],temp.textData[4][2], temp.textData[4][3]);
  changeimgzoom(temp.textData[0], temp.textData[6]);
  }
Reply With Quote
  #5  
Old 04-08-2007, 06:42 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
EDIT: Chandler got to it before me and used the wonders of string/float nondiscrimination and multi-dimensional arrays in gs2 to his advantage

This isn't a long script because it's in GS1, it's just long because it's not coded efficiently.
Anyways, as said, <200=serverside, >=200=clientside.
And second, I really urge you to look into arrays and loops to optimize this script.

PHP Code:
//#CLIENTSIDE
function customize() {
  
setstring this.gui,toguilightest.png;
  
setstring this.text,
  
"Health: #s(clientr.player_hp)/#s(clientr.player_maxhp)",
  
"Mana: #s(clientr.player_mp)/#s(clientr.player_maxmp)",
  
"Type: #s(clientr.player_type)",
  
"#e(0,13,#n)#s(this.nick)",
  
"Talik: #v(player.rupees)",
  
"Shield: #v(playershieldpower)",
  
"Weapons: #s(this.enabweap)",
    
"Lvl. Type: #s(this.zonetype)";

  
// Display options for each text object
  // x,y,red,blue,green,style options
  // style options: 0=bold, 1=bold+italic, 2=bold+right
  
this.doptions={
    
32,64,1,0,0,0,
    
32,80,0,1,1,0,
    
32,96,1,1,1,0,
    
72,48,1,1,1,1,
    
280,48,0,1,0,2,
    
280,64,1,1,1,2,
    
280,80,1,1,1,2,
    
280,96,1,1,1,2,
      };
}

if (
created || timeout) {
  
customize();
  
this.img=200;
  
showimg this.img,#s(this.gui),16,16;
  
changeimgvis this.img,4;
  
this.img++;
  
showimg this.img,#3,32,32;
  
changeimgpart this.img,0,64,32,32;
  
changeimgvis this.img,4;
  
this.img++;

  for (
i=0;i<sarraylen(this.text);i++) {
    
tokenize b bi br;
    
setstring this.style,#t(this.doptions[5+i*6]);
    
showtext this.img+i,this.doptions[i*6],this.doptions[1+i*6],Arial,#s(this.style),#I(this.text,i);
    
changeimgcolors this.img+i,this.doptions[2+i*6],this.doptions[3+i*6],this.doptions[4+i*6],1;
    
changeimgzoom this.img+i,.6;
    
changeimgvis this.img+i,4;
    
this.img++;
  }
  if (
weaponsenabledsetstring this.enabweap,Enabled;
  else 
setstring this.enabweap,Disabled;
  if (
nopkzonesetstring this.zonetype,No PKing;
  else {
    if (
issparringzonesetstring this.zonetype,Sparring;
    else 
setstring this.zonetype,PKing;
  }
  
showstats 1024;
  
timeout 0.05;

I'll explain what I did with this. First, I have the string list at the top, each string contains what text you want to display(like you had one showimg for each text). Second I have the array. This is a little complicated, but I have it hold the options for each instance of text. We'll be able to access this in the loop to organize it.

Now I use the for loop to go through the information I need and display the text for each instance of text in the string list.

EDIT: forgot to explain the variable this.img.
this.img starts at 200(the index used to make the images clientside), and increases once for every time an image is show, therefor, all images are shown on their own unique index.

And looks like you've got three scripts to play with, aren't you the lucky one

Last edited by DustyPorViva; 04-08-2007 at 06:52 PM..
Reply With Quote
  #6  
Old 04-08-2007, 06:46 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by DustyPorViva View Post
Blah blah blah
You don't use quotes ("") in GS1, So it would be:

PHP Code:
setstring this.text,
  
Health#s(clientr.player_hp)/#s(clientr.player_maxhp),
  
Mana#s(clientr.player_mp)/#s(clientr.player_maxmp),
  
Type#s(clientr.player_type),
  #e(0,13,#n)#s(this.nick),
  
Talik#v(player.rupees),
  
Shield#v(playershieldpower),
  
Weapons#s(this.enabweap),
    
LvlType#s(this.zonetype); 
__________________
What signature? I see no signature?
Reply With Quote
  #7  
Old 04-08-2007, 06:49 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You have to with those. It closes the whole thing into one string, or else Graal will break it up into different strings in the string list.
Reply With Quote
  #8  
Old 04-08-2007, 07:56 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by DustyPorViva View Post
You have to with those. It closes the whole thing into one string, or else Graal will break it up into different strings in the string list.
Correct. Your example would be the correct version of a GS1 string array.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 04-09-2007, 07:44 AM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
thanks for the help guys =D ^_^
Reply With Quote
  #10  
Old 04-10-2007, 04:34 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
  setstring this.text,
  
"Health: #s(clientr.player_hp)/#s(clientr.player_maxhp)",
  
"Mana: #s(clientr.player_mp)/#s(clientr.player_maxmp)",
  
"Type: #s(clientr.player_type)",
  
"#e(0,13,#n)#s(this.nick)",
  
"Talik: #v(player.rupees)",
  
"Shield: #v(playershieldpower)",
  
"Weapons: #s(this.enabweap)",
    
"Lvl. Type: #s(this.zonetype)"
That makes me want to barf ... it makes no sense at all. No offense to anyone personally, it's good that people are learning how to script, but GS1 makes no sense ... quotes in almost EVERY programming language ... even BASIC ... represents a string.
__________________
Reply With Quote
  #11  
Old 04-10-2007, 07:40 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by cbkbud View Post
That makes me want to barf ... it makes no sense at all. No offense to anyone personally, it's good that people are learning how to script, but GS1 makes no sense ... quotes in almost EVERY programming language ... even BASIC ... represents a string.
Personally, I prefer GS1. It's more as easy. If that makes any sense...
Reply With Quote
  #12  
Old 04-10-2007, 02:14 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
GS1 was really the more 'easier' scripting for average people with no programming knowledge to pick up. I can say if I came to Graal around now and tried to learn gscript I'd probably be too intimidated with it. I'm already having a pretty rough time learning GS2 with my prior knowledge of GS1. I always felt GS1 kind of had a 'it does exactly it says it's doing' kind of feel to it. No doubt, GS2 is a lot more powerful, it just isn't as easy to pick up.
Reply With Quote
  #13  
Old 04-10-2007, 04:36 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Shadow, perhaps you should leave your threads open when they are resolved in case other people encounter the same problem?
Reply With Quote
  #14  
Old 04-10-2007, 09:50 PM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
Quote:
Originally Posted by Twinny View Post
Shadow, perhaps you should leave your threads open when they are resolved in case other people encounter the same problem?
im used to WoW forums xD you keep a thread up to long and people get quite pissy

Will do though =)
Reply With Quote
  #15  
Old 04-10-2007, 11:29 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by DustyPorViva View Post
GS1 was really the more 'easier' scripting for average people with no programming knowledge to pick up. I can say if I came to Graal around now and tried to learn gscript I'd probably be too intimidated with it. I'm already having a pretty rough time learning GS2 with my prior knowledge of GS1. I always felt GS1 kind of had a 'it does exactly it says it's doing' kind of feel to it. No doubt, GS2 is a lot more powerful, it just isn't as easy to pick up.
Thats not a good thing really, people just need an object-oriented mentality and scripting becomes easy to pick up.
__________________
Reply With Quote
  #16  
Old 04-10-2007, 11:39 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Well the good thing about Graal back then was it was easy to pick up and edit for mostly everyone. If everyone had the object-oriented mentality, programming wouldn't be so hard for them. Graal didn't really propose that sort of problem because of it's simplicity.
Reply With Quote
  #17  
Old 04-11-2007, 01:58 AM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
Quote:
Originally Posted by DustyPorViva View Post
GS1 was really the more 'easier' scripting for average people with no programming knowledge to pick up. I can say if I came to Graal around now and tried to learn gscript I'd probably be too intimidated with it. I'm already having a pretty rough time learning GS2 with my prior knowledge of GS1. I always felt GS1 kind of had a 'it does exactly it says it's doing' kind of feel to it. No doubt, GS2 is a lot more powerful, it just isn't as easy to pick up.
That's what I'm trying to do, I played graal in '99-03 with basic scripting knowledge, and just recently came back and lost all of what I knew and just learned there was a GS2! So I bought a server and I'm going to try to use GS1 on it, then I'm going to try to duplicate everything. As you can tell though with how many posts I put up with questions to help me get further...I blow at scripting. But at least I'm learning ^_^
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:00 PM.


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