Variables

Locke
30 Aug 2003, 02:21
can I use string variables in room names? I;m trying to set something up so that say "thoran" is in your party. you set "thoran"'s name, so that when you say "look at thoran" and he's in your party, it will go to a room that says "you are looking at #partymember#'s stats. It hasn't been letting me do this however.

GameBoy
30 Aug 2003, 02:55
why do you need to goto a room which says "you are looking at #partymember#'s stats". i dont get it, why dont you print a msg saying that?

Locke
30 Aug 2003, 20:15
But how would I get rid of it saying you are in whatever room then?

GameBoy
30 Aug 2003, 21:56
i did this a while ago, let me see if i can remember it and ill paste the code for you :D


define room <roomname>
alias < >
prefix < >
indescription < >
end define


where u see the space, dont actually put a space, use Alt+0160, because thats an actual character, and im not sure if quest will still make everything blank if you use a space. but yeah, wot i put there will make the room completely blank

I think Im Dead
30 Aug 2003, 22:24
Um, your message is quite cryptic, but I'll take a guess at what you mean.

Are you talking about overriding the default(or what you've made the default) room description you've set, for listing the contents of an NPC(mob or whatever you want to call it) inventory or stats. Eh, I'll give you an example of what I'm assuming you are talking about....



>look

[The Dark Cave]
You are in a dark cave, stalagtites and 'mites jut out of nearly every surface you see except for a small trodden path leading deeper into the dark cavern. You also see a sleeping bat and Thoran.
Exits: North and South

>look at thoran

You look at Thoran...
He has shaggy brown hair, green eyes, and is wearing some mithril field plate.
Thoran's Stats:
----------------------
DEX: 13
STR: 16
CON: 18/00
INT: 8
WIS: 10
CHA: 12

>look

[The Dark Cave]
You are in a dark cave, stalagtites and 'mites jut out of nearly every surface you see except for a small trodden path leading deeper into the dark cavern. You also see a sleeping bat and Thoran.
Exits: North and South



Of course I added a lot of frills there, but that's what I'm imaging you are looking for... A general look description, and if the person is a member of your party then you should be able to see their stats(to use them to their full potential, see effects of items on stats, etc).

If this sort of thing is what you were going for, I have to say that I'd suggest doing it different. It's not neccessary to make a room to list an objects properties or variables that have been set.

The way I would go about it would be object properties(which I'm a big fan of...) for the object that is Thoran(a dex property equal to his dexterity stat, con property for his constitution stat, etc), and a conditional to check if he is your party member. This would look something like this...


command <look at #@target-object#> {
if property <#target-object#; member> and ( $objectproperty(#target-object#; member)$ = yes ) then msg <$objectproperty(#target-object#; look)$|n $displayname(#target-object#)$ Stats:|nDEX: $objectproperty(#target-object#; dex)$|nSTR: $objectproperty(#target-object#; str)$|nCON: $objectproperty(#target-object#; con)$|nINT: $objectproperty(#target-object#; int)$|nWIS: $objectproperty(#target-object#; wis)$|nCHA: $objectproperty(#target-object#; cha)$|n>
}
else msg <$objectproperty(#target-object#; look)$>

*****NOT TESTED*****


Atleast that's what I'm imaging you are wanting(or something like it). Of course you'd have to add a check to make sure the object(or npc, player) is in the room just to make sure it has no holes and such. If that was what you are thinking of, mention it, and I can throw out some help extending it to be more complete. If not, sorry for the wasting of time, but I figured I'd take a shot.

Alex
31 Aug 2003, 10:24
You can't use string variables in the name of a room or object. You can change the displayed name of the room or object though, by changing its alias property.

e.g.

property <thoran; alias=some other name>

codingmasters
30 Oct 2003, 18:55
Can you use string vriables as names, not in names, or is this something coming infuture versions of Quest?

Matthew G.

Alex
31 Oct 2003, 09:01
If I've understood correctly - no, as I said before:

You can't use string variables in the name of a room or object. You can change the displayed name of the room or object though, by changing its alias property.

e.g.

property <thoran; alias=some other name>

codingmasters
31 Oct 2003, 09:02
No, I meant, can you have a string variable [i]as[/i] a name for an object, not [i]in[/i] the object name

Matthew G.

Alex
31 Oct 2003, 09:08
Why would you want to? That would create all sorts of problems. Quest wouldn't even know what the object was called. You can only do this with an alias - otherwise you'll create a coding nightmare. Believe me, there is a better solution to your problem - whatever it is!

codingmasters
31 Oct 2003, 09:14
I didn't suggest this. I just thought it was possible, and so posted it onthis thread because the guy who started it didn't know what he was doing with variables!

Matthew G

GameBoy
31 Oct 2003, 10:21
and i suppose you do? :roll:

Variables are mainly used (well in my case) to change a value of something which will be outputted to the main window, like a name.

At the beggining of a game it could ask your name and whatever you type for it goes into the string variable #name#, and it will output the name you typed. another use i can think of at 10:20am, is for the game to check whether an object is usable. by using conditions you can check to see if a variable has a certain value. say for example. #switch# has a value of 'off'. if in the game you type 'turn on switch', you could change the string variable #switch# to 'on' then IF #switch# = on THEN 'script'.

Very useful for that.

codingmasters
01 Nov 2003, 03:17
I do have a good understanding for variables. Being a hobbyist programmer, I have to!

And i know what a variable is and does!

Matthew G.

GameBoy
02 Nov 2003, 14:34
who said my post was directed at you? :)

codingmasters
02 Nov 2003, 20:24
ummm...... no one. But that's what it looked like

Matthew G.

paul_one
03 Nov 2003, 01:44
Ste - you were obviously talking about CM!
CM - don't jump to conclusions!
CW - WOOT!

codingmasters
03 Nov 2003, 08:11
Of course. Thanks for backing me up for once CW

Matthew G.

paul_one
03 Nov 2003, 20:29
CM - I also dissed you, so again don't jump to conclusions.
CW - WOW - you're in such a good mood. I RULE EVEN MORE!!1!

codingmasters
03 Nov 2003, 21:32
CW, what is up with you? I don't get it

Matthew G.

paul_one
03 Nov 2003, 21:44
Hmmm - I'm in a good mood and I'm responding to you.
Need any more help?

codingmasters
03 Nov 2003, 21:46
With what do I need help?

Matthew G.

paul_one
03 Nov 2003, 21:52
That's what I'm asking you.

codingmasters
03 Nov 2003, 21:53
I don't need help right now

Matthew G.

paul_one
03 Nov 2003, 21:57
Are you sure?

codingmasters
03 Nov 2003, 22:02
Yes, I am very sure

Matthew G.

paul_one
03 Nov 2003, 22:05
Ok then.