How to change an object's alias

So I want to be able to change an objects alias.
Example the object is a character george, but I still give it the initial alias of Tall man in corner. Then when the player talks to him and selects to introduce themselves george gives them his name and his alias updates to George.
Is there a command to do this, or some other way?


Tall Man In Corner.usedefaultprefix = False
Tall Man In Corner.alias = "George"

^ try this it might work :) Basically you place it at the beginning of the greeting message with the tall man. Just make sure that he has an alias set as George.

Anonynn.


Thanks but I realized, I want to make the script in a object to change the alias of another.
So the player walks into the room, and sees a guy in the corner then they talk to the guy at the bar and asks who the guy in the corner is and they tell the player his name is george.
How do I do that?


I used the tutorial and added the verb "who" so you could ask the cat about the strange man.
(I don't think there was a cat in the tutorial)
msg ("You ask the cat who the stranger is.")
msg ("He replies, "He is Joe."")
Strange man.alias = "Joe"

This did change the strange man's alias to "Joe"
Joe, George... "same" thing...


I got this error when I did that.

Error running script: Error compiling expression '"Tall man in corner.alias = "George""': SyntaxError: Unexpected token "George" <IDENTIFIER>; expected one of <EOF>Line: 1, Column: 29

I don't get what I'm doing wrong?
And I did add the name George to the list of alias's for the character too


Show your line of code...
I looks, from the error, that you may have this:
"Tall man in corner.alias = "George""
when it should be this:
Tall man in corner.alias = "George"
(just a guess)


I tried that after my last post too and it didn't work, but the error message did change

Error running script: Error compiling expression 'Tall man in corner.alias = "George"': Unknown object or variable 'Tall man in corner'

and yes the code is now
Tall man in corner.alias = "George"
So now what should I do?


Now, for the part I hate most about Quest...
Read your variables VERY closely!!!
Tall man in corner.alias
is not the same as:
Tall Man In Corner.alias


Well I made that mistake when copying out the variables in my post, but I pasted the alias over and over in all places so it's all Identical but I checked it just the same and there are no diffences
Are you sure you understand I want to change the alias from another object like I said before?
I personally thought I have to specifically have to specify the object then the current alias, is that incorrect?


The last error makes it looks like a change in the Tall man's name...
Because, it is saying Tall man in corner, at this point in the code does not exist before this point.
OK, I think I found "a" if not "the" problem...
I changed my Strange man to Strange man in corner and got this error.
BUT, before the program ran...
Invalid element name. Elements cannot contain these words:
and, or, xor, not, if, in.
I think quest allowed you to create the name, then later decided that you could not use it...


Tall man in corner can be the alias, because Quest just shows you that text, but it cannot be the name of the object.


Hello.

Can you post your code? Or a link to your game?

I believe that would help clear everything right up.

I'm (sort of) thinking along the same lines as DL: Tall man in corner is not your object's name, either due to capitalization or something else. Quest should let you use that name, but I don't think that's what the name is (exactly).


Edit: Looking again at your first post, it sounds like the character's name is george and initial alias is Tall man in the corner.
In this case, the code should be george.alias = "George". The part of the command before the dot should be the object's name, spelled and capitalised exactly right.

I would suggest that in a case like that, you make the man's name George to start with, and give him the alias "Tall man in the corner".

That way, your code is simpler, and you're less likely to have a typo:
George.alias = "George"

Remember: An object's name is what Quest calls it, and must be typed 100% accurately in scripts, so you should make it as simple as possible. The object's alias is the name the player sees.


Perhaps you could when you ask the barman the man's name, add a script to remove object 'man in corner' then another script to make a previously invisible 'man in corner' ( but with alias of his name) appear. This sounds a little newbyish but it might work.


Tall Man In Corner.usedefaultprefix = False
Tall Man In Corner.alias = "George"

What is the attribute to set a new prefix?
object.prefix?


What is the attribute to set a new prefix?
object.prefix?

Yes


Okay I realized I was trying to change the Alias to the actual name of the object, though it is created with a different alias. So I started with Tall man in corner and tested it be having the code change it to Mark, and the objects non alias name is George, but that didn't work either it just gave me the result true when I ran it.
So here is the code
George.alias = "mark"
I have had so many people tell me how to code this I don't know which to apply any more lol


If you post your game's code, we will more than likely see the problem immediately.

Otherwise, we are just guessing.


Well here is the code I used to try to change the alias
George.alias = "mark"
Not sure how big an extent of the code I used you are asking for besides that?


George.alias = "mark"

If the object's name is "George", that should set his alias to "mark".
If it doesn't, then there must be something wrong elsewhere in the script.

it just gave me the result true when I ran it.

Not sure what you mean by that. An assignment statement doesn't give a result; it's a statement, not an expression.

Wait... have you got msg (George.alias = "mark") or something? If you have, that would display "true" or "false", because the = is a test for equality rather than an assignment.


Okay this is a little embaressing, I did make it an expression because I have always been confused how to make a statement in code. Can someone explain how to define something in a message as code related statement?


(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)


the '[MESSAGE]' option allows ONLY for TEXT (and text processor commands)

-------

print [MESSAGE] Hi, my name is HK
// output: Hi, my name is HK

// in code: msg ("Hi, my name is HK")

----------

print [MESSAGE] "Hi, my name is HK"
// output: "Hi, my name is HK"

// in code: msg ("\"Hi, my name is HK\"")

----------

set variable player.alias = [EXPRESSION] "HK"
// in code: player.alias = "HK"

print [MESSAGE] Hi, my name is {player.alias}
// output: Hi, my name is HK

// in code: msg ("Hi, my name is {player.alias}")

----------

set variable player.alias = [EXPRESSION] "HK"
// in code: player.alias = "HK"

print [MESSAGE] "Hi, my name is {player.alias}"
// output: "Hi, my name is HK"

in code: msg ("\"Hi, my name is {player.alias}\"")

------------------------------------------

the '[EXPRESSION]' option allows for: TEXT ONLY, VARIABLE ONLY, or TEXT+VARIABLE

(same rules apply for the text processor commands, I'll give examples below)

---

print [EXPRESSION] "Hi, my name is HK" // TEXT ONLY
// output: Hi, my name is HK

// in code: msg ("Hi, my name is HK")

----

set variable player.alias = [EXPRESSION] "HK"
// in code: player.alias = "HK"

print [EXPRESSION] player.alias // VARIABLE ONLY
// output: HK

// in code: msg (player.alias)

---

set variable player.alias = [EXPRESSION] "HK"
// in code: player.alias = "HK"

print [EXPRESSION] "Hi, my name is " + player.alias // TEXT+VARIABLE
// output: Hi, my name is HK

// in code: msg ("Hi, my name is " + player.alias)

---

set variable player.alias = [EXPRESSION] "HK"
// in code: player.alias = "HK"

print [EXPRESSION] "Hi, my name is + {player.alias}" // TEXT ONLY (+ text processor command)
// output: Hi, my name is HK

// in code: msg ("Hi, my name is {player.alias}")

---

set variable player.alias = [EXPRESSION] "HK"
set variable player.sex = [EXPRESSION] "male"
set variable player.age_integer = [EXPRESSION] 18
set variable player.age_string = [EXPRESSION] "adult"
set variable player.race = [EXPRESSION] "human"
set variable player.class = [EXPRESSION] "warrior"

// in code:
// player.alias = "HK"
// player.sex = "male"
// player.age_integer = 18
// player. age_string = "adult"
// player.race = "human"
// player.class = "warrior"

print [EXPRESSION] player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + "."

// output: HK is a 18 year old adult male human warrior.

// in code: msg (player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".")

(filler for getting my edited post, updated/posted)


set variable player.alias = [EXPRESSION] "HK"
set variable player.sex = [EXPRESSION] "male"
set variable player.age_integer = [EXPRESSION] 18
set variable player.age_string = [EXPRESSION] "adult"
set variable player.race = [EXPRESSION] "human"
set variable player.class = [EXPRESSION] "warrior"

// in code:
// player.alias = "HK"
// player.sex = "male"
// player.age_integer = 18
// player. age_string = "adult"
// player.race = "human"
// player.class = "warrior"

print [EXPRESSION] "{player.alias} is a {player.age_integer} year old {player.age_string} {player.sex} {player.race} {player.class}."

// output: HK is a 18 year old adult male human warrior.

// in code: msg ("{player.alias} is a {player.age_integer} year old {player.age_string} {player.sex} {player.race} {player.class}.")

----

set variable player.alias = [EXPRESSION] "HK"
set variable player.sex = [EXPRESSION] "male"
set variable player.age_integer = [EXPRESSION] 18
set variable player.age_string = [EXPRESSION] "adult"
set variable player.race = [EXPRESSION] "human"
set variable player.class = [EXPRESSION] "warrior"

// in code:
// player.alias = "HK"
// player.sex = "male"
// player.ageint = 18
// player. agestr = "adult"
// player.race = "human"
// player.class = "warrior"

print [EXPRESSION] "\"" + player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".\""

// output: "HK is a 18 year old adult male human warrior."

// in code: msg ("\"" + player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".\"")

Can someone explain how to define something in a message as code related statement?

You can't put a statement inside another statement, or in a function.

Not sure how to do it in the GUI (think it might be "set variable" or something like that); but if you open "code view", change that line to be just George.alias = "mark" it should work fine.


You can't put a statement inside another statement, or in a function.

Next nooby question, what's the definition of a 'statement'?


(filler for getting my edited post, updated/posted)


in simple terms (it's a lot more technical/complicated):

a programming 'statement', like a human language 'sentence' (in programming: a single line of functional code) or 'paragraph' (in programming: a block of functional code), contains a subject and a verb (action):

subject: an identifier and possibly etc/rest of header-signature/body/syntax coding for it: NAME_OF_VARIABLE or NAME_OF_FUNCTION

verb (action): an expression: an operator/operation and the Value(s)/VARIABLE(S) involved, and/or also another Function Call (NAME_OF_FUNCTION)


examples below


subject (an 'Attribute' VARIABLE):

player.alias

verb (an Assignment operation expression):

= "HK"

the 'statement':

player.alias = "HK"


the subject:

if (CONDITIONAL_EXPRESSION) { /* SCRIPTING */ }
optional (as many 'else-ifs' as you want): else if (CONDITIONAL_EXPRESSION) { /* SCRIPTING */ }
optional: else { /* SCRIPTING */ }

the verbs:

two Comparison operation Expressions and a 'OR' boolean operator/operation (for the 'if condition' of the 'if/else' Function's/block's/subject's Conditional Expression):

LCase (player.alias) = "hk"
or
LCase (player.alias) = "hegemonkhan"

and two 'msg' Function result Expressions (depending on the condition met):

msg ("You're awesome!")
// or:
msg ("Oh, okay, whatever")

the 'statement':

if (LCase (player.alias) = "hk" or LCase (player.alias) = "hegemonkhan") {
  msg ("You're awesome!")
} else {
  msg ("Oh, okay, whatever")
}

but, it gets more technical depending on how the language is constructed/designed:

https://en.wikipedia.org/wiki/Statement_(computer_science)
https://en.wikipedia.org/wiki/Expression_(computer_science)

https://en.wikipedia.org/wiki/List_of_programming_languages_by_type


Thx, it is kinda what I'd expected.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums