NPC based question

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
Well this is kind of an akward question to ask as it is probably a question that is rarely asked, the backgound for this question is i want the npc to give out a key for a room, but i want him to check if a key has already been taken out so if it has then it will say something like "sorry this room is already taken" but i cant seem to think how to do it, any ideas all those smart people?

Thank you in advance

Gorgon
 

GilgaMesh

Golden Oldie
Golden Oldie
Mar 12, 2004
698
1
155
St Helens
You gotta use flags

eg

[Main]
#if
Check [101] 1 (1 Indicating flag used)
#say
Nice one you have the key =)\
Do you want to loose the key?\
<yeah i wanna loose it/@loose>\
#Elsesay
Would you like a key?\
<Yes Please/@yes>\

[Yes]
#ACT
Give Key 1
set [101] 1
#say
you now got the key =)\

[@loose]
#ACT
Set [101] 0
#say
its mine again
 

Miles

LOMCN VIP
VIP
Mar 27, 2003
1,195
0
213
Hmm well accually you dont have to use flags, you can use namelists instead which i think are better because you can control it from the files =p

/Miles
 

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
yes i read about the namelist from somewhere, but it was to do with a different subject and was not sure how to adapt it to say checkitem room1 Gorgons : as in to check the item for room1 and it is with player Gorgon, and if there is nothing there then you could get a key and then the name would be put there etc, if that made any sence.

If somebody wouldnt mind explaining how to do the name lists, i shall have a look now for the namelist, but i fear i shall find nothing that would make sence to what im doing. Or you could show me the flags as i have never used them apart from the UnionFlag :)

The Keys you, in server would be bought from an npc but i dont want it to hand out multipul keys so would using flags only check it for the one person talking to the npc or the whole server?
 

Miles

LOMCN VIP
VIP
Mar 27, 2003
1,195
0
213
Its pretty simple, basically you do :-

#ACT
AddNameList test

to add to name list "test"

#ACT
DelNameList test

to get rid of your name from namelist "test"

#ACT
CheckNameList test

to check if your name is on the namelist "test"

and basically you can edit it in envir \ mapquest (i think) by opening "test" and editing the name etc, its much more efficient.

/Miles
 

Mario_Party

Dedicated Member
Dedicated Member
May 9, 2003
36
0
82
i don't think ne posts above have explained it properly.
What this person wants is global flags.
To do that you're going to need to create a programme that simply checks users names in namelist files... it's the only way :)
 

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
thinking about it what miles just posted does make sence, if that does actually work i THINK i know how to do it, thank you guys i will make the npc now and come back with my results :) thanks for help, but if you have any spare time and dont mind explaining how you go about making the program as i am very intreged :)
 

Mario_Party

Dedicated Member
Dedicated Member
May 9, 2003
36
0
82
there's no point doing something manually hundreds of times when you could just let a programme run when u launch the server so people can get housing or whatever instantly...
The programme I was talking about is just a simple VB programme that checks a NAMELIST for a users name and then checks to see if they already have a house... if not it will add it to say
HouseX.txt
X being the next number in the sequence of housing... such as House12.txt

This idea was taken from someone, but I created it with him.... he knows who he is :)
 

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
well i could have a look at that VB program, i did what Miles suggested today started at about 12:30 today and have only just finished it about 10 minutes ago, it is about 6000 words i think, i am hoping it works but unfortunatly i am at my work experiene at the moment, it is quiet here so they let me go on the internet to email it to myself as i am NOT typing it out again, would somebody like mario or miles have a look if this would work, i think i have checked just about everything. but i did think of a flaw when i was making it, when it checknamelist, it would only check to see if that particular person is in that room, would it check to see if there was generally just a person in there rather than a specific person ( or would it do both check to see if some1 in there, if there is check if it yourself) i shall have to dust off my VB manuals as i have not glanced at it in a while, and i am definatly going to need some help if that is ok ;) i shall upload the file in a second

gah, well i cant upload it from here so i shall try it when i get home which will be in about 45 minutes i should walk through the door :) so check back then.
 
Last edited:

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
Sorry it took so long but here they are, the bell boy now seems to have a few errors when it worked before.i moved it onto a different pc and now it doesnt want to work :/ well take a look at them and please post back on your idea to help :)

oh and i did the checknamelist thing, but wouldnt that just check if your name is in it and not just if there is any name in it?
 

Attachments

  • Bel-0101.txt
    6.4 KB · Views: 12
  • Rec-0101.txt
    38.6 KB · Views: 9

Mario_Party

Dedicated Member
Dedicated Member
May 9, 2003
36
0
82
[@main]
#IF
checkitem secretkey
#ACT
goto @smain
#ELSEACT
goto @nmain

should be

[@main]
#IF
checkitem secretkey 1
#ACT
goto @smain
#ELSEACT
goto @nmain

also

[@hnymoon]
#IF
checkitem honeymoonkey
#ACT
take honeymoonkey
mapmove honeymoon
break
#ELSESAY
You dont have a Honey Moon Key, dont lie to me!\
<Sorry/@exit>\\

should be

[@hnymoon]
#IF
checkitem honeymoonkey 1
#ACT
take honeymoonkey 1
mapmove honeymoon
break
#ELSESAY
You dont have a Honey Moon Key, dont lie to me!\
<Sorry/@exit>\\

I think this

[@room1]
#IF
checkitem room1
#THEN
mapmove room1
#ELSESAY
You dont have a key for this room, go away\
<Sorry/@exit>

should be

[@room1]
#IF
checkitem room1 1
#THEN
mapmove room1
#ELSESAY
You dont have a key for this room, go away\
<Sorry/@exit>

et cetera....
 

Gorgons

Dedicated Member
Dedicated Member
Apr 16, 2004
32
0
32
yeh but also for some strange reason i think i was getting,

#THEN
mapmove room1

as a script error, yes i have put in the map files, and yes i have done everything.

oh and btw for somereason the receptionist wont find the files needed to do thecehckname list thing

but anyway thanks :D :D :D ill check that as soon as i get home because im at my mates house!!!!
 

Mario_Party

Dedicated Member
Dedicated Member
May 9, 2003
36
0
82
you also need to make sure ur map names are exact, and i suggest u stick to upper case, as this doesn't usually cause bugs... so make the map called ROOM1 instead of room1 :)