Player Naming Character, etc.

Started by Ozwalled, Thu 29/01/2004 01:41:55

Previous topic - Next topic

Ozwalled

Is it possible for the player to do something like naming characters, objects, hotspots or inventory pieces in the game (give 'em a space to type the name in, and that's what the character's name is for the rest of the game, when referred to in dialogue and when appearing in a hotspot mouseover and such).

Can that actually be done? I've been thinking about giving it a try, but don't want to get too far into it then realize it's impossible and all.

dr_dna

Not sure, but if it's not, then you could always use SetGlobalString() to remember the names.

strazer

#2
No problem:

string buffer;
InputBox("Name: ",buffer);
StrCopy(character[xxx].name, buffer);

Where xxx is the script name of the character. Same way with objects I guess.

EDIT: Checked the manual. There don't appear to be functions to set object, inventory or hotspot names. You may want to look into custom properties though.

strazer

#3
Hm, I've just run into a similar situation.
I want to change the name of a hotspot at runtime. At first, the hotspot has no name/description ("", could as easily be "???"), then when the player examines and identifies it, it should change to whatever it is he found.

I'm using @OVERHOTSPOT@ to display its name next to the mouse cursor, that's why it's important to change the name itself.

So I think a call for SetHotSpotName, SetObjectName and so forth is in order?

EDIT: It just occurred to me, as a workaround I could use 2 hotspots, one with no name, and another disabled one. When the first one is examined, it is disabled and the second one enabled.
Still, I think the above functions would be useful.

Proskrito

#4
Its in chris' list: http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=6489;start=msg79201#msg79201 ;)

Another workaround:
you would make a function where you would define the conditions for a new name to appear, like:
Code: ags

function ChangeNames(string name){
int room=character[GetPlayerCharacter].room;
if (room==3 && GetHotspotAt(mouse.x,mouse.y)==4 && [somecondition]){//if hotspot 4 in room 3 and some other condition
 StrCopy(name,"new name");//change the name
}
else if (GetInvAt(mouse.x,mouse.y)==5 && [othercondition]{
string buffer;
GetGlobalString(1,buffer);
StrCopy(name,buffer);
}
else if (....

and then in the rep. execute something like this to show the name in a label:
Code: ags

GetLocationName(mouse.x,mouse.y,buffer);
ChangeNames(buffer);
SetLabelText(GUI,LABEL,buffer);

So, in hotspot 4 of room 3, if [somecondition] is true, the label would show 'new name', and if the inv. item is 5 and [othercondition] true, the name would be the global string #1.
(not sure if those functions are written properly, but you get the idea)
so you just have to write the proper conditions and i think it would work fine. : )

strazer

QuoteIts in chris' list

Yikes! Sorry to be redundant. :P

Quotenot sure if those functions are written properly, but you get the idea

I think for this one occasion I'll go with my solution, but I'll certainly keep your idea in mind(=hdd ;) ). Very nice!

Thank you!

SMF spam blocked by CleanTalk