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 01-02-2013, 10:49 PM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Showing Text & Images On Screen

Hey guys!
I'm back to developing and Graal in general. I was wondering how I would approach creating text and images appearing on a screen for a Heads up display. I tried various methods such as with(findimg(200)) {, etc. However the result was showing on X and Y coordinates of the level instead of X and Y coordinates of the players screen. I need a way to approach this, and an easy way too. Also, just an additional question, how would I use catchEvent() to detect if a player clicked on an image/text in the HUD? Anyways this is also my 300th post, so its a double event for me haha. Thanks for helping guys.
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #2  
Old 01-02-2013, 10:59 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
set the layer to 4 or up

PHP Code:
with (findImg(200)) {
  
layer 4;
  
screen_x_here;
  
screen_y_here;
  
text "sup dude";

__________________
MEEP!
Reply With Quote
  #3  
Old 01-02-2013, 11:01 PM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Quote:
Originally Posted by callimuc View Post
set the layer to 4 or up

PHP Code:
with (findImg(200)) {
  
layer 4;
  
screen_x_here;
  
screen_y_here;
  
text "sup dude";

Thanks! Let me try this out! Now all I need is a way to use catchevent for it.
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #4  
Old 01-03-2013, 06:11 PM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of light
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
It's always bugged me that you two exist.
__________________
Reply With Quote
  #5  
Old 01-03-2013, 07:31 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 ff7chocoboknight View Post
It's always bugged me that you two exist.
They have more value in this community than you ever will.

@Astram: You will have to use a GuiShowImgCtrl if you want to 'catchevent' anything related to that image.
__________________
Quote:
Reply With Quote
  #6  
Old 01-03-2013, 08:25 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
While using a GUI Control is ideal for stuff related to clicking, with normal displays you could try something such as this:

PHP Code:
//#CLIENTSIDE
function showHUD(){
  
this.addHUDObj(this.showimg(200"image.png"xy), 32324);

  
this.addHUDObj(this.showimg(201"image2.png"xy), 64644);

  
temp.this.showtext(202xy"tempus sans itc""b""text");
  
temp.t.zoom 0.5;
  
temp.gettextwidth(temp.t.zoomtemp.t.fonttemp.t.styletemp.t.text);
  
temp.gettextheight(temp.t.zoomtemp.t.fonttemp.t.styletemp.t.text);
  
this.addHUDObj(temp.ttemp.wtemp.h5);
}

function 
addHUDObj(temp.displaytemp.wtemp.htemp.layer){
  
temp.display.dwidth temp.w;
  
temp.display.dheight temp.h;
  
temp.display.layer temp.layer;
  
this.displays.add(temp.display);
}

function 
onMouseDown(temp.button) {
  if(
temp.button != "left")
    return;

  for(
temp.this.displays){
    if(
      
mousescreenx in <temp.d.xtemp.d.temp.d.dwidth> &&
      
mousescreeny in <temp.d.ytemp.d.temp.d.dheight>
    ){
      
this.startDrag(temp.d);
      return;
    }
  }
}

function 
startDrag(temp.d){
  
this.dragobj temp.d;
  
this.draglayer this.dragobj.layer;
  
this.draglayer 6;
  
this.dragoffx mousescreenx this.dragobj.x;
  
this.dragoffy mousescreeny this.dragobj.y;
  
this.scheduleEvent(0.05"Drag""");
}

function 
onDrag(){
  if(!
leftmousebutton){
    
this.dragobj.layer this.draglayer;
    return;
  }
  
this.dragobj.min(max(0mousescreenx this.dragoffx), screenwidth this.dragobj.dwidth);
  
this.dragobj.min(max(0mousescreeny this.dragoffy), screenheight this.dragobj.dheight);
  
this.scheduleEvent(0.05"Drag""");


Last edited by ffcmike; 01-03-2013 at 08:38 PM..
Reply With Quote
  #7  
Old 01-03-2013, 08:58 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by ffcmike View Post
While using a GUI Control is ideal for stuff related to clicking, with normal displays you could try something such as this:

PHP Code:
if(
      
mousescreenx in <temp.d.xtemp.d.temp.d.dwidth> &&
      
mousescreeny in <temp.d.ytemp.d.temp.d.dheight>
    ) 
wouldnt it have to be like the following?
PHP Code:
if(
  
mousescreenx in |temp.d.xtemp.d.temp.d.dwidth| &&
  
mousescreeny in |temp.d.ytemp.d.temp.d.dheight|

if not, what would the < > 's do exactly in this case (i know that they can be used for smaller, bigger checks but wouldnt make sense in here like i am used to it)?
__________________
MEEP!
Reply With Quote
  #8  
Old 01-03-2013, 09:03 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by callimuc View Post
wouldnt it have to be like the following?
PHP Code:
if(
  
mousescreenx in |temp.d.xtemp.d.temp.d.dwidth| &&
  
mousescreeny in |temp.d.ytemp.d.temp.d.dheight|

if not, what would the < > 's do exactly in this case (i know that they can be used for smaller, bigger checks but wouldnt make sense in here like i am used to it)?
Using |,| includes the minimum and maximum value, allowing an edge-on intersect, whereas with <,> it has to be within the range. It doesn't matter so much in this case.
Reply With Quote
  #9  
Old 01-03-2013, 09:04 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
Controls are definitely the way to go if you want to have absolutely any kind of interactive interface. Just remember that controls steal input and therefor if you're creating something like a HUD you have to remember to give focus back to GraalControl and various other things so you don't constantly end up with the whole "I press up but I don't move until I click the screen" situation.

http://forums.graalonline.com/forums...96&postcount=9

Also controls are always on their own higher layer and can never be drawn below showimg() content.
Reply With Quote
  #10  
Old 01-04-2013, 05:29 AM
ff7chocoboknight ff7chocoboknight is offline
Skyzer Zolderon
ff7chocoboknight's Avatar
Join Date: Dec 2006
Location: New Hampshire, United States
Posts: 725
ff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of lightff7chocoboknight is a glorious beacon of light
Send a message via AIM to ff7chocoboknight Send a message via MSN to ff7chocoboknight
Quote:
Originally Posted by fowlplay4 View Post
They have more value in this community than you ever will.

@Astram: You will have to use a GuiShowImgCtrl if you want to 'catchevent' anything related to that image.
I don't care if they are in this community nor do I care about value, I care that they exist.
__________________
Reply With Quote
  #11  
Old 01-04-2013, 08:03 AM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
Quote:
Originally Posted by ff7chocoboknight View Post
I don't care if they are in this community nor do I care about value, I care that they exist.
__________________
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 11:41 PM.


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