Mystic Software Forums

Mystic Software - Hosted Sites => Dark Age Games => Topic started by: DarkElite on January 29, 2004, 08:07:49 AM

Title: (no subject)
Post by: DarkElite on January 29, 2004, 08:07:49 AM
is there any way to make a variable by adding text and another variable?

ex.
#variable!=3
#finalvar!=var+iable+!
#Mwin(finalvar!) *should show 3 in message window

althought im fairly certain that will not work, but you get the basic idea.
Title: (no subject)
Post by: DarkElite on January 29, 2004, 08:09:50 AM
and also being able to add variable into the added variable
Title: (no subject)
Post by: DarkElite on January 29, 2004, 08:12:46 AM
ex.
#crap$=cool
#finalvariable$=the+one+crap$+is+$
#Mwin(finalvariable$) *show "theonecoolis"
Title: (no subject)
Post by: Cesque on January 29, 2004, 08:58:19 AM
The second example works, the first one doesn't.

var+iable+! is not "variable!", though...

#code$ = "var"+"iable"+"!"+"=3"
#rpgcode(code$)

...works.

Variables are divided into literal($) and numeral(!) and one of them can't be added or subtracted to another one, if types don't match. Use #cast-xxx commands to turn variables between numeral and literal.
Title: (no subject)
Post by: Xorlak on January 29, 2004, 07:31:19 PM
Yep.  And to refine the second:

#crap$="cool"
#finalvariable$="theone"+crap$+"is"
#Mwin(finalvariable$) *show "theonecoolis"
Title: (no subject)
Post by: DarkElite on February 03, 2004, 08:16:59 AM
so for something like a shop, or item getting sorta thing could i do this?

Code: [Select]
#itm1$=potion
#castnum(itm1$,itm1!)
#itm1!=itm1!+1

would that cause potion! to go up? or only the itm1! variable?
Title: (no subject)
Post by: Cesque on February 03, 2004, 10:34:00 AM
No, only the variable. "potion" equals 0 as a number, so itm1! equals 0+1=1.

I don't get exactly what you want to do... Up the "potion"? Make it "potion2"?
Title: Re: +'ing To Make Variables?
Post by: dooms102 on September 12, 2007, 09:41:23 PM
ummm.... I think I know what you are doing. But doing that gets you nowhere leave that first literal variable alone. but also have a numeric variable of the same name for a counter. so instead of that just add or subtract from potion!
Title: Re: +'ing To Make Variables?
Post by: Dude Man on September 13, 2007, 01:09:40 PM
This topic was made before half the people who post here have even joined. I'm sure the problem is fixed and/or forgotten.
Title: Re: +'ing To Make Variables?
Post by: D. Ein on September 13, 2007, 05:17:47 PM
And the other half no longer post. Smile