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-13-2008, 04:10 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Any idea?

Any idea why this wont change nick?

NPC Code:
    
function onCreated() {
new GuiTextEditCtrl("RiotGamesys_TextEdit2") {
profile = GuiBlueTextEditProfile;
height = 20;
text = player.nick;
width = 122;
x = 176;
y = 23;

function onTimeout(){
player.nick = RiotGamesys_TextEdit2.text;
}
setTimer(.05);}
function RiotGamesys_Button11.onAction() {
RiotGamesys_Button11.active = false;
player.nick = RiotGamesys_TextEdit2.text;
RiotGamesys_Button11.active = true;
}
}

Reply With Quote
  #2  
Old 01-13-2008, 04:28 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Is this the whole script? It looks kinda 'unfinished' like some parts are missing..

Like the button action event is there, but the button script part isn't there.
Also you need to set player.nick serverside :O
__________________
Reply With Quote
  #3  
Old 01-13-2008, 04:59 PM
Grey Grey is offline
Classic Developer
Grey's Avatar
Join Date: Mar 2007
Location: Wales, UK
Posts: 134
Grey will become famous soon enough
Send a message via AIM to Grey
Quote:
Originally Posted by Jeffyy View Post
Any idea why this wont change nick?
First I'll point you to Skyld's code formatting thread:
http://forums.graalonline.com/forums...ad.php?t=61805

Making your text more readable will help you to see script problems in the long run and others will be able to give you help more easily.

You cannot have a function within a function, as you have both onTimeout and the action function for the button being instigated inside onCreated, ensure that one function is closed before you start the next.

You may be ill-advised trying to do this with GUI if you don't have a lot of scripting experience because as Chompy mentioned, unless you posted a semi-complete script, the button part is missing. Also you do not need the timeout for what you are trying to achieve.

If you're determined doing this with GUI then Twinny's site is good for GUI basics: http://resource.nukedstudios.org/ind...?page=quickgui
Reply With Quote
  #4  
Old 01-13-2008, 05:33 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Chompy View Post
Also you need to set player.nick serverside :O
Key statement here
__________________
Reply With Quote
  #5  
Old 01-13-2008, 05:52 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
As far as I can see, you got your timeout function inside your textedit control declaration, which is inside your created event and also includes another function. What the ****?
Reply With Quote
  #6  
Old 01-13-2008, 06:24 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
PHP Code:

function onActionserverside() {
  switch(
params[0]) {
    case 
"changename":
      
player.nick params[1];
    break;
  }
}

//#CLIENTSIDE
function onCreated() {
  
onTimeout();
}

new 
GuiTextEditCtrl("RiotGamesys_TextEdit2") {

  
profile GuiBlueTextEditProfile;
  
height 20;
  
text player.nick;

  
width 122;
  
176;
  
23;

}



function 
onTimeout(){
  if (
player.nick != RiotGamesys_TextEdit2.text) {
    
triggerserver("weapon"name"changename"RiotGamesys_TextEdit2.text);
  }
  
setTimer(.05);
}

function 
RiotGamesys_Button11.onAction() {
  
RiotGamesys_Button11.active false;
  
triggerserver("weapon"name"changename"RiotGamesys_TextEdit2.text);
  
RiotGamesys_Button11.active true;

I know that some people learn by example, and the posts in this thread aren't going to help you much, good luck
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 01-13-2008, 08:04 PM
Jeffyy Jeffyy is offline
Graphics Artist
Jeffyy's Avatar
Join Date: Dec 2007
Location: USA, NJ
Posts: 82
Jeffyy is an unknown quantity at this point
Well, I didn't think i needed to post the WHOLE script. Thats the only part thats wrong with it and Thanks tig, That did it. What i completely forgot was to add server side, I had Client side at the top of the script.
Reply With Quote
  #8  
Old 01-13-2008, 09:50 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Jeffyy View Post
Well, I didn't think i needed to post the WHOLE script. Thats the only part thats wrong with it and Thanks tig, That did it. What i completely forgot was to add server side, I had Client side at the top of the script.
Hmm, I would suggest using a lower timeout tho
__________________
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:20 PM.


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