Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   How to test for a number... (https://forums.graalonline.com/forums/showthread.php?t=7586)

konidias 07-18-2001 05:05 PM

How to test for a number...
 
Ok I'm stumped.. how would it be possible to check what the player says via #c, and check to see if the text is a number?

What I mean is like, if the player says "adosfj", then check if its a number, if it isn't perform an else, but if they say "23502", then it would be correct.

Basically to check if its a number and not letters or other characters.

Shard_IceFire 07-18-2001 09:14 PM

NPC Code:

if (playerchats) {
if (!strcontains(#c,0)||!strcontains(#c,1)||!strconta ins(#c,0)||!strcontains(#c,0)||!strcontains(#c,0)| |!strcontains(#c,0)||!strcontains(#c,0)||!strconta ins(#c,0)||!strcontains(#c,0)||!strcontains(#c,0)) {
setplayerprop #c,;
}
}


Hehe I'm not that good at stuff like that...but I think that should work...

grim_squeaker_x 07-18-2001 09:25 PM

Hmm...
NPC Code:
if (playerchats) {
this.test=0;
for (i=0;i<strlen(#c);i++) {
this.test=strcontains(#e(i,1,#c),-1234567890);
}
if (this.test==1) setplayerprop #c,Whoa, you only said numbers!@;
else setplayerprop #c,Hmm, that wasn't all numbers;
}


Shard_IceFire 07-18-2001 09:34 PM

:eek:

konidias 07-18-2001 09:54 PM

Hmm that seems close LM.. but its not working right for some reason.. it always says it doesn't have all numbers =/

konidias 07-19-2001 04:46 PM

Someone make a logical guess please.. *boost*

BeZeRkEr 07-19-2001 10:23 PM

i have no clue y0

CyanideSR71 07-19-2001 10:44 PM

doesn't if (playersaysnumber) work?

BeZeRkEr 07-19-2001 10:45 PM

hmm
i never heard of that command..

G_yoshi 07-19-2001 10:54 PM

you could possibly use tokenize :D

KJS 07-19-2001 11:01 PM

Quote:

Originally posted by CyanideSR71
doesn't if (playersaysnumber) work?
yea it does or should...

that was what I was like when people were comming up with these long scripts lol....


that is how I made a bank script a long time ago..

grim_squeaker_x 07-20-2001 02:10 AM

Quote:

Originally posted by CyanideSR71
doesn't if (playersaysnumber) work?
Well you keep ending up creating variables with what you just said if don't say a number while using that.

BeZeRkEr 07-20-2001 08:36 AM

all these new commands are confusing meh!@
i need to learn how to use keydown
LM help, y0


All times are GMT +2. The time now is 06:51 AM.

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