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 07-16-2005, 12:16 PM
raiden0899 raiden0899 is offline
Registered User
raiden0899's Avatar
Join Date: Oct 2004
Posts: 192
raiden0899 is on a distinguished road
Question need help

im working on a money system and i'm trying to figure out how to change the value of the money variables. heres a part of the script:
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,strtofloat(client.dollars)+=1;
}
}


when i press n, it changes dollars to "strtofloat(client.dollars)+=1" instead of raising it by 1. can someone tell me what i'm doing wrong?
Reply With Quote
  #2  
Old 07-16-2005, 12:30 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
Quote:
Originally Posted by raiden0899
im working on a money system and i'm trying to figure out how to change the value of the money variables. heres a part of the script:
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,strtofloat(client.dollars)+=1;
}
}


when i press n, it changes dollars to "strtofloat(client.dollars)+=1" instead of raising it by 1. can someone tell me what i'm doing wrong?
try
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,#v(strtofloat(#s(client.dollars))+= 1);
}
}

Reply With Quote
  #3  
Old 07-16-2005, 12:49 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Make it clientr.dollers so they can't be edited.
__________________
Reply With Quote
  #4  
Old 07-16-2005, 12:51 PM
raiden0899 raiden0899 is offline
Registered User
raiden0899's Avatar
Join Date: Oct 2004
Posts: 192
raiden0899 is on a distinguished road
Quote:
Originally Posted by projectigi
try
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,#v(strtofloat(#s(client.dollars))+= 1);
}
}

that sets it to 0 when i press n
Reply With Quote
  #5  
Old 07-16-2005, 12:57 PM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
NPC Code:
if (keypressed) {
if (strequals(#p(1),n)) {
setstring clientr.dollars,#v(strtofloat(#s(clientr.dollars)) + 1);
}
}

__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
  #6  
Old 07-16-2005, 01:02 PM
raiden0899 raiden0899 is offline
Registered User
raiden0899's Avatar
Join Date: Oct 2004
Posts: 192
raiden0899 is on a distinguished road
Quote:
Originally Posted by Polo
NPC Code:
if (keypressed) {
if (strequals(#p(1),n)) {
setstring clientr.dollars,#v(strtofloat(#s(clientr.dollars)) + 1);
}
}

thanks. i just needed to change the +=1 to +1
Reply With Quote
  #7  
Old 07-17-2005, 05:41 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
Make the keypress trigger that code serverside so that it can edit the clientr.var
__________________
In a world of change... Who'll you believe?
Reply With Quote
  #8  
Old 07-18-2005, 09:30 PM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
Quote:
Originally Posted by Velox Cruentus
Make the keypress trigger that code serverside so that it can edit the clientr.var
Try not to crash the server, if you do that.
Reply With Quote
  #9  
Old 07-19-2005, 04:23 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by ChibiChibiLuc
Try not to crash the server, if you do that.
I wonder how thats gonna crash the server
__________________

Reply With Quote
  #10  
Old 07-19-2005, 06:41 PM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
KeyPressed is called every .05.
Sending triggers to the serverside that often is painful.
I found that out when I typo'd an NPC on Babylon. :[

But then again, their server's a piece of crap.
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 07:05 PM.


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