Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-18-2009, 09:18 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Anchoring Knockoff.

Trying to emulate the anchoring support I asked for.

It appears to be hitting the proper case in switch statement, yet does not set x and y accordingly.

Adding debug checks such as "player.chat = this.ANCHOR_TOP[0] - (GControl.width / 2);" give me the position I want, but the x/y always ends up being 0.

edit: also not complete, once I get this issue out of the way I'll add x-y offsets as well.

PHP Code:
function onCreated()
{
findplayer("mark sir link").addweapon(this.name);
}

//#CLIENTSIDE
function onCreated()
{
  
this.ANCHOR_TOP = {screenwidth/20}; //12 O'Clock
  
this.ANCHOR_TOPRIGHT = {screenwidth0}; //between 1-2 O'Clock
  
this.ANCHOR_RIGHT = {screenwidthscreenheight/2}; //3 O'Clock
  
this.ANCHOR_BOTTOMRIGHT = {screenwidthscreenheight}; //between 4-5 O'Clock
  
this.ANCHOR_BOTTOM = {screenwidth/2screenheight}; //6 O'Clock
  
this.ANCHOR_BOTTOMLEFT = {0screenheight}; //between 7-8 O'Clock
  
this.ANCHOR_LEFT = {0screenheight/2}; //9 O'Clock
  
this.ANCHOR_TOPLEFT = {00}; //between 10-11 O'Clock
  
  
this.ANCHORS = {ANCHOR_TOPANCHOR_TOPRIGHTANCHOR_RIGHTANCHOR_BOTTOMRIGHTANCHOR_BOTTOMANCHOR_BOTTOMLEFTANCHOR_LEFTANCHOR_TOPLEFT};  

  new 
GuiWindowCtrl("Test_Window") {
  
profile "GuiBlueWindowProfile";
  
this.anchor "TOP";
  
width 160;
  
height 80;
  
text "Window";
  
canmove true;
  
editing true;
  
canclose true;
  
destroyonhide true;
}
  
anchorPosition(Test_Window);

}


function 
anchorPosition(GControl)
{
  
with(GControl)
  {
    switch (
this.anchor)
    {
    case 
"TOP":
      
text thiso.test;
      
thiso.ANCHOR_TOP[0] - (width 2);
      
thiso.ANCHOR_TOP[1];
      break;
    case 
"TOPRIGHT":
      
thiso.ANCHOR_TOPRIGHT[0] - width;
      
thiso.ANCHOR_TOPRIGHT[1];
      break;
    case 
"RIGHT":
      
thiso.ANCHOR_RIGHT[0] - width;
      
thiso.ANCHOR_RIGHT[1] - (height 2);
      break;
    case 
"BOTTOMRIGHT":
      
thiso.ANCHOR_BOTTOMRIGHT[0] - width;
      
thiso.ANCHOR_BOTTOMRIGHT[1] - height;
      break;
    case 
"BOTTOM":
      
thiso.ANCHOR_BOTTOM[0] - (width 2);
      
thiso.ANCHOR_BOTTOM[1] - height;
      break;
    case 
"BOTTOMLEFT":
      
thiso.ANCHOR_BOTTOMLEFT[0];
      
thiso.ANCHOR_BOTTOMLEFT[1]; - height;
      break;
    case 
"LEFT":
      
thiso.ANCHOR_LEFT[0];
      
thiso.ANCHOR_LEFT[1] - (height 2);
      break;
    case 
"TOPLEFT":
      
thiso.ANCHOR_TOPLEFT[0];
      
thiso.ANCHOR_TOPLEFT[1];
      break;
    default:
      
0;
      
0;
    }
  }

Reply With Quote
 


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 01:10 AM.


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