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 10-03-2001, 03:49 AM
MrCoolDude MrCoolDude is offline
Registered User
Join Date: Jul 2001
Posts: 74
MrCoolDude is on a distinguished road
Question About Random

Can random be used with letters somehow? Ex:
PHP Code:
Random(a,z
That doesn't work, is there another way to do this? Maybe Stefan should make the command work with letters as well as numbers.
__________________
Mista Neat
Reply With Quote
  #2  
Old 10-03-2001, 03:51 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Re: Question About Random

Quote:
Originally posted by MrCoolDude
Can random be used with letters somehow? Ex:
PHP Code:
Random(a,z
That doesn't work, is there another way to do this? Maybe Stefan should make the command work with letters as well as numbers.
yeah but there is a command for it but i am not sure what it is ....
Reply With Quote
  #3  
Old 10-03-2001, 03:51 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

Of course that doesn't work if you're talking about variables. You're asking it for a random from a to z, not the value of variable a to variable z. That would be

random(#v(a),#v(b))

I believe.
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #4  
Old 10-03-2001, 03:53 AM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
It cannot be used with letters unless you use some special scripting, E.G this:
NPC Code:
if (playertouchsme) {
this.i=int(random(0,26));
message #e(this.i,1,abcdefghijklmnopqrstuvwxyz);
}


And AlphaFlame, random is a function which uses variables so it doesn't need the #v
__________________

Reply With Quote
  #5  
Old 10-03-2001, 03:54 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
you could make a string 26 characters long with the alphabet, then use the random for 1 through 26 and do a part string with that number
Reply With Quote
  #6  
Old 10-03-2001, 03:55 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
it seems i posted a little too slow
Reply With Quote
  #7  
Old 10-03-2001, 03:57 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by grim_squeaker_x
It cannot be used with letters unless you use some special scripting, E.G this:
NPC Code:
if (playertouchsme) {
this.i=int(random(0,26));
message #e(this.i,1,abcdefghijklmnopqrstuvwxyz);
}


And AlphaFlame, random is a function which uses variables so it doesn't need the #v
you can make this shorter:

NPC Code:

if (playertouchsme) {
message #e(int(random(0,26)),1,abcdefghijklmnopqrstuvwxyz) ;
}



not much shorter but better
Reply With Quote
  #8  
Old 10-03-2001, 03:57 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
so ....

Quote:
Originally posted by entravial
~AlphaFlame~

Of course that doesn't work if you're talking about variables. You're asking it for a random from a to z, not the value of variable a to variable z. That would be

random(#v(a),#v(b))

I believe.
so if i used:
NPC Code:

if (created)
setstring testing,random(#v(a),#v(z));
message #s(testing);
}


A letter between A and Z might appear ?
Reply With Quote
  #9  
Old 10-03-2001, 04:04 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
or you could do this:

NPC Code:

if (created) {
setstring testing,#e(int(random(0,26)),1,abcdefghijklmnopqrs tuvwxyz);

message #s(testing);
}

Reply With Quote
  #10  
Old 10-03-2001, 04:34 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

My apologies then, btedji. I personally don't use variables with random... too much trouble really.

And yes, use btedji's letter script. It works. Though I can't see why you need a random letter...
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #11  
Old 10-03-2001, 05:21 AM
IceHawk IceHawk is offline
Jenseits von Gut und Böse
IceHawk's Avatar
Join Date: Mar 2001
Location: Vancouver BC, Canada
Posts: 4,704
IceHawk will become famous soon enough
Send a message via AIM to IceHawk
can make it a random hole number then assign all letters to a #
like
1 = a
2 = b
etc.
__________________
Reply With Quote
  #12  
Old 10-03-2001, 05:56 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by Kaimetsu
I'm surprised nobody has realised the correct way to do this yet.

#K
Just another way of doing it, and it's far harder to make any random sequence of letters possible with using #K.
__________________

Reply With Quote
  #13  
Old 10-03-2001, 09:03 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
then kammy why not just tell the person who asked how to do it with #k... instead of saying all you rejects #k is better...
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #14  
Old 10-03-2001, 09:14 PM
Shard_IceFire Shard_IceFire is offline
Registered User
Shard_IceFire's Avatar
Join Date: Jun 2001
Location: Eastern Harkoonia
Posts: 861
Shard_IceFire is on a distinguished road
Quote:
then kammy why not just tell the person who asked how to do it with #k... instead of saying all you rejects #k is better...
We know he can script it, it's just a matter of whether or not he'll post it.
__________________

-=Shard IceFire=-
Reply With Quote
  #15  
Old 10-04-2001, 03:06 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
Quote:
Originally posted by Shard_IceFire

We know he can script it, it's just a matter of whether or not he'll post it.
there never was a good description of #k
Reply With Quote
  #16  
Old 10-05-2001, 06:37 AM
MrCoolDude MrCoolDude is offline
Registered User
Join Date: Jul 2001
Posts: 74
MrCoolDude is on a distinguished road
Ok, thanks for the help everyone...I'll have to mess around with #K sometime.
__________________
Mista Neat
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 12:20 AM.


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