forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Random variable name

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Tue Oct 16, 2012 9:12 am    Post subject: Random variable name Reply with quote

Hi all

Does anyone know how to create a random variable name?
For example...
Code:
%%@random(1024) = foo

Does not work.

Thanks

David...
Back to top
View user's profile Send private message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Tue Oct 16, 2012 2:24 pm    Post subject: Reply with quote

# %%len lenght of the variable you want
%%len = 10

%x = 0

# The string containing the characters you want included in the variable name
%a = abcdefghijklmnopqrstuvwxyz

# Will hold the final variable name
%%tmp =
# You should seed the random, otherwise you will prob get the same word
RANDOM @datetime(shn)
repeat
%b = @random(1,@len(%a))
%c = @substr(%A,%b,%b)
%%tmp = %%tmp%c
%x = @fadd(%x,1)
until @equal(%x,%%len)

INFO Your Tmp word is: %%tmp
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Tue Oct 16, 2012 2:55 pm    Post subject: Reply with quote

I think he wants the variable name itself to be random. There is no way to have a random variable name created.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Tue Oct 16, 2012 3:16 pm    Post subject: Reply with quote

oops... should have read it correctly !.... my bad !

aw well it give me 10 mins of thinking about it ! Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue Oct 16, 2012 4:13 pm    Post subject: Reply with quote

Hi guys:

There is no way to create a random variable name... Anyway, it's not useful. No clue

I think ... can create a list where to save a random name associated with a value. This way:

"randomname"|value
"randomname"|value
"randomname"|value

etc.

I hope that will be useful
_____________

uVeDeSe
_____________
Back to top
View user's profile Send private message Visit poster's website
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Thu Oct 25, 2012 8:08 am    Post subject: Reply with quote

Thanks for your help, shame you can't do random variables.

David...
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 5:44 pm    Post subject: Reply with quote

Didn't solve your problem...but I did learn something from trying!!

Code:

%%r@random(1024) = foo

info %%r@random(1024)

%%s@sum(1,2) = ""

info %%s@sum(1,2)
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 5:48 pm    Post subject: Reply with quote

Now if I could only figure out WHY I find this interesting...

Code:

dialog create,_
%%filedlg@filedlg() = ""
info %%filedlg@filedlg()
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 6:00 pm    Post subject: Reply with quote

Approach cautiously. Not all parameters to functions translate well using this um.. err.. whatever it is.

Code:
dialog create,_

%%filedlg@filedlg(Bitmap|*.bmp) = Who's throwing Handles!
info %%filedlg@filedlg()

%%filedlg = @filedlg(Bitmap|*.bmp)
info Who's throwing Handles!%%filedlg
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 766
Location: Eastman, GA

PostPosted: Thu Oct 25, 2012 6:10 pm    Post subject: Reply with quote

OK, figured this one out.

VDS is dumping the function, and the function is refreshed when trying to call it.

so in the case of
%%filedlg@filedlg() = "foo"

%%filedlg is equal to foo. The @filedlg() piece is dropped.

When referencing back it's confusing, because you make the call

info %%filedlg@filedlg() the @filedlg() piece is actually called/referenced to where in the declaration it is not.

So, as we were.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group