ID:262611
 
Code:
mob/verb
Swap_Files(mob/m in view(usr),F as file)
switch(alert(m,"[usr] is offering to swap [F] with you. Would you like to trade?","File Swap","Yes","No"))
if("Yes")
alert(m,"Select a file to swap with [usr]'s [F].","File Swap")
var/F2 as file
switch(alert(usr,"[m] offered [F2] in return. Do you accept these conditions? (Your [F] for [m]'s [F2])","File Swap","Yes","No"))
if("Yes")
m<<ftp(F)
usr<<ftp(F2)
alert(m,"[usr] accepted the file","Files Accepted")
alert(usr,"[m] accepted the file","Files Accepted")
if("No")
alert(m,"[usr] declined the file","Files Declined")
if("No")
alert(usr,"[m] declined the file","Files Declined")


Problem description:
When it comes to [M] selecting a file to swap for [usr]'s file. It doesn't prompt to select a file, it prompts to save [usr]'s file.
Are you realy realy realy good with coding? Because if you are, I could use some help on an RPG that I want to make... I havn't even started, because I don't now how... Sad, but I want to play a game that is perfect for me, and that I like, and the only way to get the VERY feel, is to makemy own... Of course with the help of other people...
In response to Serebii
I'm not like expert good. I don't know any complex coding. Just basics and a little bit of the harder stuff.
In response to OnLy SoUlJaH
Well, can anyone help?
Where's the coding that usr selects their file? Where is the coding for when m selects a file?
In response to Justin Knight
F as File is the [Usr] select file. And var/F2 as file is [M]'s but it doesn't work.
In response to OnLy SoUlJaH
I see your problem, have you tested it with actual people? I tested it by myself and saw what you posted about. I did a few things to try to fix it but i'm not familar with the "as file" thing.
In response to Justin Knight
Yes I have tested it. And the [M] does not get prompted to select a file, only to save [usr]'s file.
In response to OnLy SoUlJaH
Can nobody help?
I think you can use something along the lines of var/F2 = input() as file, but I'm not sure.
In response to Jon88
I've changed it, and all that does is end the code there.
In response to OnLy SoUlJaH
AHHHHHH! Nobody knows how to fix it! AHHHHHH!
Eh.. I am just going to rewrite the code. I'll tell you if I actually notice anything wrong, but for one, I don't think 'as file' works outside of the parentesis of a proc.
mob/verb
Swap_Files(mob/M in view())
if(alert(M,"Trade Files with [src]?","Trade File","Yes","No")=="No") return
var/file=input(src,"Trade File:","Swap Files")as null|file //Give a chance to cancel procedure
if(!file) return //Cancel if tere was no file selected
var/file2=input(M,"Trade File:","Swap Files")as null|file //Chance to cancel
if(!file2) return //If no file was selected, cancel proc
if(alert(M,"Trade your [file2] for [file]?","Trade","Accept","Cancel")=="Cancel") {alert(src,"Denied");return}
if(alert(usr,"Trade your [file] for [file2]?","Trade","Accept","Cancel")=="Cancel") {alert(M,"Denied");return}
M<<ftp(file)
src<<ftp(file2)


Also, I find it best to use 'src'instead of 'usr' whenever possible. It helps avoid what is known as 'usr abuse.' I really don't like tat term, but I can't think of any better one.
Anyway, that verb includes quite bit of ways to cancel the proc. Just making sure the players want to carry out what they wish.

Sorry if it doesn't work, I have no way of testing it, I'm onmy dad's laptop... Anyone else dislike laptops because of the keyboard or that stupid little mouse pad thing? I can' stad it. Wish I had meh laptop.

About the 'usr abuse' thing, how do you like 'usr maltreatment?'
In response to CaptFalcon33035
CaptFalcon33035 wrote:
Also, I find it best to use 'src'instead of 'usr' whenever possible. It helps avoid what is known as 'usr abuse.' I really don't like tat term, but I can't think of any better one.

This is a verb. usr is perfectly safe in a verb. (That is, unless you're calling that verb like a proc, which most programs don't do.)

usr abuse is when you use it inside a proc--and not a verbish proc like Click(), mind you, but a regular run-of-the-mill one like Logout(). While there are certain instances where it makes sense to put usr in a proc, they occur very seldom, and a newbie should avoid this at all costs.

Lummox JR
In response to Lummox JR
I'm sorry. What I meant was using 'src' whenever possible reduces the risk of you usr abusing, in a sense of the programmer getting accustomed to using 'usr' all the time.
In response to CaptFalcon33035
I feel the exact same way, I only use usr in Click(), DblClick(), and other things of the such. When you HAVE to use usr--I use it. When I have the option between using usr and something else, I'll the other thing.
In response to Ol' Yeller
Ol' Yeller wrote:
I feel the exact same way, I only use usr in Click(), DblClick(), and other things of the such. When you HAVE to use usr--I use it. When I have the option between using usr and something else, I'll the other thing.

The important thing is to know the difference between when you have to use usr, and when you don't. Many newbies see Enter(), for example, as a place where they "have to" use usr because src is obviously not right. Problem is, they forget that Enter() takes an argument. Likewise you see all the time when somebody writes a DeathCheck() proc and simply doesn't think to send it all the information it needs.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
usr abuse is when you use it inside a proc--and not a verbish proc like Click(), mind you, but a regular run-of-the-mill one like Logout(). While there are certain instances where it makes sense to put usr in a proc, they occur very seldom, and a newbie should avoid this at all costs.

Lummox JR

Oooo...I know a reason to use "usr" in a proc - when adding procs to use in a mobs "verbs" list. =D
In response to Teh Governator
Teh Governator wrote:
Oooo...I know a reason to use "usr" in a proc - when adding procs to use in a mobs "verbs" list. =D

Well that's kind of a given. If the proc is only going to be used as a verb, you can treat it as one.

Lummox JR
In response to Teh Governator
Oh, I know!
proc/asdf(mob/m)
if(!m)return
usr=m
world<<"usr abuse is okay, [usr] = [m]."
Page: 1 2