Post: Easy way to position Shaders/Text
12-31-2011, 06:39 PM #1
d7w7z
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); I was making a menu and got annoyed by the fact I had to keep making the patch over and over trying to guess good X and Y values, So I made this function to move elements around the screen.

    
PosTest(D) {
switch(D) {
case "U":
self moveOverTime( .1 );
self.Moving[self.TestNum].y -= 5;
break;
case "D":
self moveOverTime( .1 );
self.Moving[self.TestNum].y += 5;
break;
case "L":
self moveOverTime( .1 );
self.Moving[self.TestNum].x -= 5;
break;
case "R":
self moveOverTime( .1 );
self.Moving[self.TestNum].x += 5;
break;
case "Re":
self iPrintln("x: " + self.Moving[self.TestNum].x);
self iPrintln("y: " + self.Moving[self.TestNum].y);
break;
case "Sw":
self.TestNum++; if(self.TestNum > self.Moving.size) { self.TestNum =0; }
self iPrintln("Editing " + self.TestNum);
break;
} }

LoopRun( function, event, input) {
for(;Winky Winky {
self waittill( event );
self thread [[function]]( input );
} }



Make a function like this and add all the items you want to be able to move(shaders and text both work) to self.Moving. Don't forget to change "dpad_XXXX" to whatever controls your menu uses.
    
MenuDebug() {
self.Moving=[]; self.TestNum=0;
self.Moving[0]=self.scrollbar1;
self.Moving[1]=self.BackGroundHud;

self thread LoopRun( ::PosTest, "dpad_right", "R"); //Move Right
self thread LoopRun( ::PosTest, "dpad_left", "L"); //Move left
self thread LoopRun( ::PosTest, "dpad_up", "U" ); //Move Up
self thread LoopRun( ::PosTest, "dpad_down", "D"); //Move Down
self thread LoopRun( ::PosTest, "button_cross", "Re"); //Print X and Y values of current element
self thread LoopRun( ::PosTest, "button_square", "Sw"); //Switch to next element in self.Moving
}


Once you fine a good spot, print the X and Y then put the values as the X and Y for your element.
I might also add a way to scale the item up/down later...
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to d7w7z for this useful post:

Cmd-X, x_DaftVader_x
01-17-2012, 10:18 PM #20
Originally posted by Correy View Post
    
Shader( element )
{
p = self createFontString( undefined, 2 );
p setPoint( "TOPRIGHT" );
for(;Winky Winky
{
element.y += attackButtonPressed();
element.x += adsButtonPressed();
p setText( element + " Y: " + element.y + " " + element + " X:" + element.x );
wait .3;
}
}


how do i call it in a Menu?
01-17-2012, 10:30 PM #21
Correy
I'm the Original
Originally posted by sniipezZ View Post
how do i call it in a Menu?


function is Shader, input is the shader your moving
01-17-2012, 10:37 PM #22
Originally posted by Correy View Post
function is Shader, input is the shader your moving

Like this

::Shader,"rank_prestige10");?
01-17-2012, 10:54 PM #23
Originally posted by Correy View Post
function is Shader, input is the shader your moving


skript compile Error:

[ATTACH=CONFIG]14832[/ATTACH]
01-17-2012, 11:00 PM #24
Correy
I'm the Original
Originally posted by sniipezZ View Post
skript compile Error:

[ATTACH=CONFIG]14832[/ATTACH]


add self before the buttons.
01-18-2012, 04:17 AM #25
Originally posted by Correy View Post
but, it still works..


just add a wait 1.0; and the end before the loop ends. and destroy elem Smile

---------- Post added at 12:17 AM ---------- Previous post was at 12:14 AM ----------

not true.

have you ever got a infinite loop error?
01-18-2012, 11:00 AM #26
Originally posted by d7w7z View Post
I meant change them to the notify's that your menu uses. Obviously there is a way to get dpad buttons working, IW uses it for the game menu.

Yeah but I think they use buttonPressed("DPAD_UP"), and that's host only, but the game runs off their own system, so it would only apply to themselves, if you get me, kinda comp to explain.
01-18-2012, 01:46 PM #27
Originally posted by nZxMikeeeyx View Post
Yeah but I think they use buttonPressed("DPAD_UP"), and that's host only, but the game runs off their own system, so it would only apply to themselves, if you get me, kinda comp to explain.


                  execKeyInt DPAD_RIGHT {
scriptmenuresponse "DPAD_RIGHT";
}
execKeyInt DPAD_LEFT {
scriptmenuresponse "DPAD_LEFT";
}
execKeyInt DPAD_UP {
scriptmenuresponse "DPAD_UP";
}
execKeyInt DPAD_DOWN {
scriptmenuresponse "DPAD_DOWN";
}
execKeyInt BUTTON_A {
scriptmenuresponse "BUTTON_A";
}
execKeyInt BUTTON_B {
scriptmenuresponse "BUTTON_B";
}
execKeyInt BUTTON_X {
scriptmenuresponse "BUTTON_X";
}
execKeyInt BUTTON_Y {
scriptmenuresponse "BUTTON_Y";
}
execKeyInt BUTTON_LSHLDR {
scriptmenuresponse "BUTTON_LSHLDR";
}
execKeyInt BUTTON_RSHLDR {
scriptmenuresponse "BUTTON_RSHLDR";
}
execKeyInt BUTTON_START {
scriptmenuresponse "BUTTON_START";
}
execKeyInt BUTTON_BACK {
scriptmenuresponse "BUTTON_BACK";
}
execKeyInt BUTTON_LSTICK {
scriptmenuresponse "BUTTON_LSTICK";
}
execKeyInt BUTTON_RSTICK {
scriptmenuresponse "BUTTON_RSTICK";
}
execKeyInt BUTTON_LTRIG {
scriptmenuresponse "BUTTON_LTRIG";
}
execKeyInt BUTTON_RTRIG {
scriptmenuresponse "BUTTON_RTRIG";
}


---------- Post added at 01:46 PM ---------- Previous post was at 01:44 PM ----------

Originally posted by d7w7z View Post
.
^^^^ multiquote fail..
01-18-2012, 04:48 PM #28
Originally posted by x. View Post
                  execKeyInt DPAD_RIGHT {
scriptmenuresponse "DPAD_RIGHT";
}
execKeyInt DPAD_LEFT {
scriptmenuresponse "DPAD_LEFT";
}
execKeyInt DPAD_UP {
scriptmenuresponse "DPAD_UP";
}
execKeyInt DPAD_DOWN {
scriptmenuresponse "DPAD_DOWN";
}
execKeyInt BUTTON_A {
scriptmenuresponse "BUTTON_A";
}
execKeyInt BUTTON_B {
scriptmenuresponse "BUTTON_B";
}
execKeyInt BUTTON_X {
scriptmenuresponse "BUTTON_X";
}
execKeyInt BUTTON_Y {
scriptmenuresponse "BUTTON_Y";
}
execKeyInt BUTTON_LSHLDR {
scriptmenuresponse "BUTTON_LSHLDR";
}
execKeyInt BUTTON_RSHLDR {
scriptmenuresponse "BUTTON_RSHLDR";
}
execKeyInt BUTTON_START {
scriptmenuresponse "BUTTON_START";
}
execKeyInt BUTTON_BACK {
scriptmenuresponse "BUTTON_BACK";
}
execKeyInt BUTTON_LSTICK {
scriptmenuresponse "BUTTON_LSTICK";
}
execKeyInt BUTTON_RSTICK {
scriptmenuresponse "BUTTON_RSTICK";
}
execKeyInt BUTTON_LTRIG {
scriptmenuresponse "BUTTON_LTRIG";
}
execKeyInt BUTTON_RTRIG {
scriptmenuresponse "BUTTON_RTRIG";
}


---------- Post added at 01:46 PM ---------- Previous post was at 01:44 PM ----------

^^^^ multiquote fail..

Exactly....

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo