ID:167488
 
i am trying to make a dbl click code where you double click the teleporter and it asks you for the cheat code and u can enter like 12 different codes to go to places. I also want it so that the menu that comes up is costomizable so i can make it say what i want, but i can only make it show up as a verb so far here is the code


mob/verb/teleport(cheats as text)
if(cheats<="esto")
loc=locate(5,5,1)
turf/Teleporter
//set icon stuff.
var/Passwords="lol,monkey"
Dbl_Click()
var/Pass=input("Whats the password?")
if(find_text(Pass,Passwords)
alert("Right password!")
//Do rest here.
else alert("Wrong password.")


Is that what you want?
untested.
In response to Flame Sage
It'd be better to make Passwords a list.

*Edit*

In addition, most of that is just plain wrong. For one, there's no find_text() proc.
In response to Flame Sage
doesnt work


i made this code
turf/teleport/DblClick(cheats as text)
input("Whats the password?")
if(cheats<="esto")
loc=locate(5,5,1)




but it says cant change constant value
In response to Mxjerrett
if(cheats<="esto")

Explain what you're trying to do there.
In response to DeathAwaitsU
make a cheat code
In response to Mxjerrett
mob/verb/Cheat()
usr << "You cheated"


There, that's a cheat code.

Now how about you answer my question which was reffering to one specific line of coding?
In response to DeathAwaitsU
How can something be less than or equal to text? That's what you have there. <= doesn't mean if thans what the incoming is thats right. You'll want******if(cheat == "esto")******like that.
In response to Pyro_dragons
hmmm well i had it setup in my last cheat system that if you click a verb that said cheat you could type a number of cheats and you would the if(cheat<="esto") or if(cheat <= "sesuoh") or wut ever to enter cheats but now i need to change that to the double click.


But is still doesnt work. The problem isnt with the if line. Theres a problem with the loc locate line it change the constant value
In response to Mxjerrett
Mxjerrett wrote:
The problem isnt with the if line.

The if line is a problem, it's just not the one you're trying to fix right now. There is a huge difference between "working" and "working properly." Anything that comes alphabetically before "esto" will satisfy that condition. Entering "apple", "cheese", "deoxyribonucleic acid", and even "Z" (since capital letters come before lowercase letters by the computer's thinking) will all teleport the player to locate(5, 5, 1). You need "==" in that expresion if you want it to only react to the unique word "esto".


Theres a problem with the loc locate line it change the constant value

The proc belongs to a turf, so src is that turf. Any vars that are not declared locally or globally have an implied src. so you are trying to modify the turf's loc. You get that error because turf position can not be changed at runtime. Since this is occuring inside DblClick() usr will be the mob of the person clicking the turf, and the atom whose loc you want to change.
In response to Shadowdarke
so if i enter the locating that they click it should work
In response to Mxjerrett
Oh for the love of God, MxJerret. PLEASE, PLEASE read the DM Guide.
turf/teleporter/Click()
var/list/cheats=list("monkey","banana")
var/pass=input("Pass?") as text
if(FindText(pass,cheats)) usr.loc=locate(x,y,z)
In response to Mysame
ok but please answer 1 last question how come the findtext is undefined
In response to Mysame
Mysame wrote:
Oh for the love of God, MxJerret. PLEASE, PLEASE read the DM Guide.
turf/teleporter/Click()
var/list/cheats=list("monkey","banana")
var/pass=input("Pass?") as text
if(FindText(pass,cheats)) usr.loc=locate(x,y,z)


And for the love of us, Mysame, please use 2 or more spaces for a tab.

Lummox JR
In response to Lummox JR
i fixed it i found out i only had to make all of the findtext lowercase i thought that might work thanks everyone for the help and thx mysame i will go read the guide


[edit]
oh this works better you can actually set multiple locatings this way:
turf/teleport/DblClick()
var/pass=input("Please enter a TTP (Time Travel Password). They are gathered by going through time. Each level gives you another password.","TTP (Time Travel Password)") as text
if(pass=="home") usr.loc=locate(1,1,1)
if(pass=="esto") usr.loc=locate(1,1,2)
if(pass=="kina") usr.loc=locate(1,1,3)
if(pass=="sonte") usr.loc=locate(1,1,4)
if(pass=="meca") usr.loc=locate(1,1,5)
if(pass=="haza") usr.loc=locate(1,1,6)
if(pass=="hesteo") usr.loc=locate(1,1,7)
if(pass=="mons") usr.loc=locate(1,1,8)
if(pass=="kinch") usr.loc=locate(1,1,9)
if(pass=="mezta") usr.loc=locate(1,1,10)
if(pass=="kesho") usr.loc=locate(1,1,11)
if(pass=="kento") usr.loc=locate(1,1,12)
if(pass=="12yaz") usr.loc=locate(1,1,13)
if(pass=="hestia11") usr.loc=locate(1,1,14)
if(pass=="1h2y") usr.loc=locate(1,1,15)
if(pass=="carlo71") usr.loc=locate(1,1,16)
if(pass=="hency") usr.loc=locate(1,1,17)
if(pass=="slecto") usr.loc=locate(1,1,18)