Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Gui Text Edit Problem (https://forums.graalonline.com/forums/showthread.php?t=134266982)

clarke119 08-13-2012 09:56 PM

Gui Text Edit Problem
 
Hey Guys,

As you may understand - I have recently returned to Graal and I am trying to learn Scripting again.

My problem is probably simple, however I do not remember how to solve this:

I have two text edit boxes on my Gang System, one for account name and the other for rank. The Account works fine when adding via the add. But the problem is how do I make the account work with the rank.

Think of it like this:
Quote:

Account name: [account1.txt - Text Edit]
Rank: [rank1.txt Text Edit]

(Update Button)
I am finding the account via:
PHP Code:

 temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
  }
 } 

I thought it Would be as simple as something like: pl.clientr.gangrank = rank1.txt but obviously not.

Please help me resolve this issue,

Thanks in advance,
Clarke.

BlueMelon 08-14-2012 02:10 AM

When you click the button, send the text to serverside to set the clientr player variables.

clarke119 08-14-2012 02:15 AM

Quote:

Originally Posted by BlueMelon (Post 1701725)
When you click the button, send the text to serverside to set the clientr player variables.

Example please?

cbk1994 08-14-2012 02:23 AM

Quote:

Originally Posted by clarke119 (Post 1701726)
Example please?

Almost this same question was asked a few weeks ago:

Quote:

Originally Posted by cbk1994 (Post 1699866)
You can read more about serverside, clientside, and triggers here.

You can find a simple example of responding to clicks on GUI buttons here.


clarke119 08-14-2012 02:29 AM

Quote:

Originally Posted by cbk1994 (Post 1701728)
Almost this same question was asked a few weeks ago:

Neither of them have what I'm looking for? Basically I'm just trying to get pl.clientr.gangrank = rank1.txt, but its deleting the clientr.gangrank flag altogether?

cbk1994 08-14-2012 03:48 AM

Quote:

Originally Posted by clarke119 (Post 1701731)
Neither of them have what I'm looking for? Basically I'm just trying to get pl.clientr.gangrank = rank1.txt, but its deleting the clientr.gangrank flag altogether?

Both of them contain pieces of what you're looking for. Where are you stuck? Post your code so far.

BlueMelon 08-14-2012 03:50 AM

Post your source so we can help you. We are not going to spoon feed

clarke119 08-14-2012 03:19 PM

Quote:

Originally Posted by cbk1994 (Post 1701737)
Both of them contain pieces of what you're looking for. Where are you stuck? Post your code so far.

This is the involved parts - not the full script. This is the last attempt I made at trying to do this..

PHP Code:

function onActionServerside(){
 if(
params[0] == "rankchanger"){
    
temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
        
rank pl.clientr.gangrank;
        
rights pl.clientr.gangrights;
 }
}
      else{
      
player.chat "Player not found.";
 }
}

//#CLIENTSIDE
function onCreated() {
 new 
GuiTextEditCtrl("account1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 120;
      
70;
      
40;
    }
    new 
GuiTextEditCtrl("rank1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 120;
      
70;
      
70;
    }
new 
GuiTextEditCtrl("rights1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 30;
      
94;
      
96;
    }

function 
UpdateButton.onAction() {
 
temp.rank rank1.txt;
 
temp.rights rights1.txt;
  
triggerserver("gui",this.name,"rankchanger",account1.text,temp.rank,temp.rights);



Tim_Rocks 08-14-2012 07:50 PM

Good idea, we could use more gang servers.

maximus_asinus 08-14-2012 08:46 PM

u scared bro? ^

clarke119 08-14-2012 09:23 PM

Haha, I laughed at them two comments:L - Anyone know how to fix this then?

Tim_Rocks 08-14-2012 09:57 PM

I know what the issue is, if you want help I'll do so later. My iPhone makes it difficult to help right now.

clarke119 08-14-2012 10:16 PM

Quote:

Originally Posted by Tim_Rocks (Post 1701793)
I know what the issue is, if you want help I'll do so later. My iPhone makes it difficult to help right now.

Okay Thank you!

callimuc 08-14-2012 10:50 PM

Quote:

Originally Posted by clarke119 (Post 1701759)
PHP Code:

function UpdateButton.onAction() {
 
temp.rank rank1.txt;
 
temp.rights rights1.txt;
 
triggerserver("gui",this.name,"rankchanger",account1.text,temp.rank,temp.rights);



should be
PHP Code:

 temp.rank rank1.text;
 
temp.rights rights1.text

It might be because it's just a part of the code and you cutted stuff out but you also forgot the closing bracket } for the onCreated() part.

You also should give your guis another naming. Check this thread for some help

clarke119 08-14-2012 11:13 PM

Quote:

Originally Posted by callimuc (Post 1701798)
should be
PHP Code:

 temp.rank rank1.text;
 
temp.rights rights1.text

It might be because it's just a part of the code and you cutted stuff out but you also forgot the closing bracket } for the onCreated() part.

You also should give your guis another naming. Check this thread for some help

Yeah it's just because I took parts of code - Also It still wont work, i've fixed that stupid mistake.

callimuc 08-14-2012 11:51 PM

Quote:

Originally Posted by clarke119 (Post 1701759)
This is the involved parts - not the full script. This is the last attempt I made at trying to do this..

PHP Code:

function onActionServerside(){
 if(
params[0] == "rankchanger"){
    
temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
        
rank pl.clientr.gangrank;
        
rights pl.clientr.gangrights;
 }
}
      else{
      
player.chat "Player not found.";
 }



Just realized that part. You mixed this
PHP Code:

rank pl.clientr.gangrank;
rights pl.clientr.gangrights

it should be

PHP Code:

pl.clientr.gangrank params[2];
pl.clientr.gangrights params[3]; 

Also you should find the player with findPlayer(acc); rather than using findPlayerByCommunityname(acc); since not everyone got a communityname. In the end it should look like:
PHP Code:

function onActionServerside(){
  if(
params[0] == "rankchanger"){
    
temp.pl findPlayer(params[1]);
    if (
temp.pl != NULL){
      
pl.clientr.gangrank params[2];
      
pl.clientr.gangrights params[3];
    }
    else {
      
player.chat "Player not found.";
    }
  }



clarke119 08-15-2012 12:44 AM

Quote:

Originally Posted by callimuc (Post 1701801)
Just realized that part. You mixed this
PHP Code:

rank pl.clientr.gangrank;
rights pl.clientr.gangrights

it should be

PHP Code:

pl.clientr.gangrank params[2];
pl.clientr.gangrights params[3]; 

Also you should find the player with findPlayer(acc); rather than using findPlayerByCommunityname(acc); since not everyone got a communityname. In the end it should look like:
PHP Code:

function onActionServerside(){
  if(
params[0] == "rankchanger"){
    
temp.pl findPlayer(params[1]);
    if (
temp.pl != NULL){
      
pl.clientr.gangrank params[2];
      
pl.clientr.gangrights params[3];
    }
    else {
      
player.chat "Player not found.";
    }
  }



Excellent. Thank you very much for your help!

Tim_Rocks 08-15-2012 12:46 AM

Oh good you were able to fix it, the other part I was gonna add to it was to check rights to see if you can even hire to begin with.

Side note, findplayerbycommunityname(acc) will change to findplayer(acc) by default if null.

clarke119 08-15-2012 12:55 AM

Quote:

Originally Posted by Tim_Rocks (Post 1701813)
Oh good you were able to fix it, the other part I was gonna add to it was to check rights to see if you can even hire to begin with.

Side note, findplayerbycommunityname(acc) will change to findplayer(acc) by default if null.

Yeah, I already have the checks in place, but removed to avoid confusion and make it as easy as possible for people to understand. Since I quit, I sometimes have these moments were I make mistakes and forget simple thing!

Also, yeah thats what I thought:O.

Anyway thanks a lot for your help guys, an asset to the forums!

callimuc 08-15-2012 01:38 AM

Quote:

Originally Posted by Tim_Rocks (Post 1701813)
Side note, findplayerbycommunityname(acc) will change to findplayer(acc) by default if null.

Oh didn't know that. Cool


All times are GMT +2. The time now is 01:36 PM.

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