Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-24-2011, 05:52 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Changing text in timeout.

I am working on a staff boots script for Lexia, and I don't want it to be just an old boring staff boots script, so I have added a little display to tell you your speed and to also show a little staff boots image too. Here is what the display says.
NPC Code:
Speed: 1

It is reading the speed. However, when I press the = key (increase speed), it doesn't recognise that the speed has changed at all and still shows 1;
Here is the code.
PHP Code:
//#CLIENTSIDE
function onKeyPressed(codeKey) {
  if (
Key == "z") {
    
setTimer(0.05);
    if (
this.mode == 0) {
      
this.mode 1;
      
player.chat "On";
      
this.speed 1;
    } else {
      
this.mode 0;
      
player.chat "Off";
    }
  }
  if (
Key == "=") {
    
this.speed this.speed 1;
  }
}

function 
onTimeout() {
  if (
this.mode == 1) {
    
showingimage();
    for (
temp.key 0key 4key++) {
      if (
keydown(key)) {
        
player.+= (vecx(key) * this.speed);
        
player.+= (vecy(key) * this.speed);
      }
    }
  }
  if (
this.mode == 0) {
    
hidingimage();
  }
  
setTimer(0.05);
}

function 
ShowingImage() {
  
with(findimg(200)) {
    
image "wboots.png";
    
layer 4;
    
screenwidth 675;
    
screenheight 610;
  }
  
with(findimg(201)) {
    
text "Speed: " this.speed;
    
screenwidth 638;
    
screenheight 601;
    
zoom 0.7;
    
layer 4;
  }
}

function 
HidingImage() {
  
hideimg(200);
  
hideimg(201);

The code isn't finished yet, as you can see there is no way to decrease speed and the display is still very simple. The display is attached below.
Attached Images
 
__________________
Reply With Quote
  #2  
Old 09-24-2011, 05:54 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
You need to use thiso.speed in your with container.
Reply With Quote
  #3  
Old 09-24-2011, 05:55 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Crow View Post
You need to use thiso.speed in your with container.
Thanks for that crow. Can you explain why I needed to use thiso.speed? I won't learn otherwise
__________________
Reply With Quote
  #4  
Old 09-24-2011, 05:58 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
Quote:
Originally Posted by Emera View Post
Thanks for that crow. Can you explain why I needed to use thiso.speed? I won't learn otherwise
Inside a with container, this refers to that specific object (in this case, the image/text). To access the object the with container resides in you need to use thiso. The "o" is for "original", I guess.
Reply With Quote
  #5  
Old 09-24-2011, 06:00 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Crow View Post
Inside a with container, this refers to that specific object (in this case, the image/text). To access the object the with container resides in you need to use thiso. The "o" is for "original", I guess.
Thank you. Green pepper coming your way when I can :O
Need to spread some rep first.
__________________

Last edited by Emera; 09-25-2011 at 02:57 PM..
Reply With Quote
  #6  
Old 09-24-2011, 06:16 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Pardon the double post!
I am having some other problems with the Ganis I am using. I want to use a gani to enhance the boots script a bit, and it works fine when you go into the gani mode, but coming out makes an idle character over my real character. Here is the script and both ganis.

Script
PHP Code:
function onKeyPressed(codeKey) {
  if (
Key == "z") {
    
setTimer(0.05);
    if (
this.mode == 0) {
      
this.mode 1;
      
this.speed 1;
      
player.attr[23] = "lexia_boots.gani";
    } else {
    
this.mode 0;
    
player.attr[23] = "lexia_unboots.gani";
    }
  }
  if (
Key == "=") {
    
this.speed this.speed 1;
  }
  if (
Key == "-") {
    
this.speed this.speed 1;
  }

Attached Files
File Type: gani lexia_boots.gani (8.0 KB, 124 views)
File Type: gani lexia_unboots.gani (7.9 KB, 131 views)
__________________
Reply With Quote
  #7  
Old 09-24-2011, 06:35 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
Try setting the 23rd attribute to an empty string when "unequipping" it. Should do the trick.
Reply With Quote
  #8  
Old 09-24-2011, 06:36 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
done that, character just remains invisible.
__________________
Reply With Quote
  #9  
Old 09-24-2011, 09:35 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
Try getting rid of all the sprites in the ganis.
__________________
Quote:
Reply With Quote
  #10  
Old 09-25-2011, 05:38 PM
cbk1996 cbk1996 is offline
Banned
Join Date: Sep 2011
Location: Kentucky
Posts: 5
cbk1996 has a little shameless behaviour in the past
Send a message via AIM to cbk1996
Try grabbing the MD5 hash of the string and make sure it doesn't return a NULL entity! If it does; you're in trouble.
Reply With Quote
  #11  
Old 09-25-2011, 05:49 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Why are you posting on all the threads MD5 hash?
__________________
Reply With Quote
  #12  
Old 09-25-2011, 06:40 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
Quote:
Originally Posted by Emera View Post
Why are you posting on all the threads MD5 hash?
Because that's cbk1996, not cbk1994
Reply With Quote
  #13  
Old 09-25-2011, 06:43 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Crow View Post
Because that's cbk1996, not cbk1994
Yeah. It that really allowed? He is impersonating him. Other members have been banned for doing that.
__________________
Reply With Quote
  #14  
Old 09-26-2011, 02:56 AM
Unkownsoldier Unkownsoldier is offline
Ignorance has no future
Join Date: Sep 2008
Posts: 1,287
Unkownsoldier is on a distinguished road
It just seems to me that you ask a scripting question almost every day, if not more. I understand that it is not easy nor is it a quick learn. But I would suggest you find someone to teach you, someone good. I don't mind the questions, but its kind of annoying when you hit "new posts" and half of them are scripting questions. This isn't just you, but a lot of other people. Granted you want to finish your scripts and you want a quick answer so you go to the forums, but it just seems old after a while. I have never remembered when the coding forum was this active, let alone by a 2-3 individuals Nothing personal of course.
__________________
Look beyond the monitor.
Reply With Quote
  #15  
Old 09-26-2011, 03:00 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Unkownsoldier View Post
It just seems to me that you ask a scripting question almost every day, if not more. I understand that it is not easy nor is it a quick learn. But I would suggest you find someone to teach you, someone good. I don't mind the questions, but its kind of annoying when you hit "new posts" and half of them are scripting questions. This isn't just you, but a lot of other people. Granted you want to finish your scripts and you want a quick answer so you go to the forums, but it just seems old after a while. I have never remembered when the coding forum was this active, let alone by a 2-3 individuals Nothing personal of course.
Ok, first off, stop the trolling. Secondly, this is the place in the forums to post scripting questions. The people who answer my questions (mainly fp4, crow and cbk1994), don't have to answer my questions. It is none of your concern what and when I post in the forums. End of story.

Quote:
I don't mind the questions,
I don't give a crap. You aren't answering them.

Quote:
Granted you want to finish your scripts and you want a quick answer
Almost 75% of the codes I post here are for my learning benefit.

Quote:
kind of annoying when you hit "new posts" and half of them are scripting questions
I think you have some kind of issue. It pains me to see your name in the online members bar at the bottom of the index, bu I don't make a fuss. Get over yourself for christ sake.


so that means...
__________________

Last edited by Emera; 09-26-2011 at 03:27 AM..
Reply With Quote
Reply


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:16 AM.


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