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-22-2001, 07:36 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Small question

when generating random numbers
i'm using this code
PHP Code:
setstring server.random,#v(random(1,5)); 
but i keep getting things like
server.random=2.056879

any idea on how i can make it so it only generated whole numbers?
Reply With Quote
  #2  
Old 09-22-2001, 07:44 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Re: Re: Small question

Quote:
Originally posted by Kaimetsu


The int() function is your best friend in the world.

now i have to go read the commands :[
Reply With Quote
  #3  
Old 09-22-2001, 07:48 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Quote:
int( var ) the integer value of a variable (truncates the floating point part)
ok i got this far
but i don't know how to properly do it like
setstring server.random,int(random(1,5));
i tryed like that
and
setstring server.random,#v int(random(1,5));
and
setstring server.random,i#v,int(random(1,5));

:[
Reply With Quote
  #4  
Old 09-22-2001, 07:56 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
yay
setstring server.roll1,#v(int(random(1,6)));
Reply With Quote
  #5  
Old 09-22-2001, 08:07 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin

now i am at my next problem
the point was to send the data to another npc
which i did
now im doing a check in the other
so i want to do like
if (timeout) {
a = #s(server.1);
b = #s(server.2);
c = #s(server.3);
timeout = 1;
}

if (timeout) {
if (a==b) {
myaction;
}

like that
but when i try to do
a = #s(server.1);

i get the error

Error: Expected format var, var[i], obj[i].attr, function(a), function(a,b)

Reply With Quote
  #6  
Old 09-22-2001, 08:21 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
yeah i want to compare the strings to eachother
like if (string 1 = string 2) {
action;
}

if (string 2 = string 3) {
action;
}

if (string 3 = string 1) {
action;
}

Reply With Quote
  #7  
Old 09-22-2001, 08:25 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
i tryed doing that and i could not get it :{
Reply With Quote
  #8  
Old 09-22-2001, 08:30 AM
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
lol...n00b.
__________________

-=Shard IceFire=-
Reply With Quote
  #9  
Old 09-22-2001, 08:32 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Quote:
Originally posted by Shard_IceFire
lol...n00b.
cool i am a newbie because i am assitant accounts admin woo
crawl back in your hole.
Reply With Quote
  #10  
Old 09-22-2001, 08:33 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Quote:
Originally posted by Kaimetsu


To see if string 1 is the same as string 2, use:

if(strequals(#s(string1),#s(string2))){
stuffyo;
}
love4kai
Reply With Quote
  #11  
Old 09-22-2001, 08:46 AM
Merlin Merlin is offline
Banned
Merlin's Avatar
Join Date: Jul 2001
Location: Merlin - U S A Malak - United Kingdom
Posts: 2,543
Merlin is on a distinguished road
Send a message via ICQ to Merlin Send a message via AIM to Merlin
Quote:
Originally posted by Kaimetsu


Just doin' what I do.
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 09:04 AM.


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