ID:142466
 
Code:
mob
//login logout
Login()
switch(input("Do you want to play or view","View or Play") in list("Play","View"))
if("Play")
if(!p1)
usr.loc = locate(5,5,1)
p1 = TRUE&usr.name
usr<<"You are player 1"
else if(!p2)
usr.loc = locate(6,5,1)
p2 = TRUE&usr.name
usr<<"You are player 2"
else if(!p3)
usr.loc = locate(5,6,1)
p3 = TRUE&usr.name
usr<<"You are player 3"
else if(!p4)
usr.loc = locate(6,6,1)
p4 = TRUE&usr.name
usr<<"You are player 4"
else if(p1&&p2&&p3&&p4)
usr<<"There isn't enough slots right now."
usr.move = 0
world<<"[src] is viewing the game."
world<<"[src] has logged in."
usr.icon = 'pacman.dmi'
else
usr.move = 0
world<<"[src] is viewing the game."
..()
p++
FindWinner()
acheck()

Logout()
world<<"[src] has logged out"
p--


Problem description:
runtime error: type mismatch: "Rickoshay" & 1
proc name: Login (/mob/Login)
source file: Bubbles.dm,9
usr: Rickoshay (/mob)
src: Rickoshay (/mob)
call stack:
Rickoshay (/mob): Login()


What are you even trying to do? & is bitwise-and, and that only works on integers.
In response to Popisfizzy
Its part of a multiplayer game its sort of like pacman lol. Right. How could i make p1 become true and also have the usr.name thats my aim if you get what i mean.
In response to Rickoshay
That tells me nothing of what you were trying to do. If you told me what you were attempting to do with that totally broken piece of code, I could help you.
In response to Popisfizzy
It doesn't matter now i've fixed it just me being stupid :). Anyways thanks for your help this topic can be deleted.
In response to Rickoshay
Topics aren't deleted for mundane reasons like a problem being fixed. That's just insane to consider.
In response to Popisfizzy
Hmm maybe they should be would make more space wouldn't it?
Here this works for what your doing.
mob
Login()
switch(input("Do you want to view or play?") in list("Play","View"))
if("Play")
if(!p1)
loc=locate(5,5,1)
p1=src
src<<"You are player 1"

A few tips, you dont need any prefixes in Login or Logout, it knows who your talking about. By that, I mean src. and usr. For this specific case you don't need them, and you don't need them in hardly any procs or verbs linked directly to the player. In fact in my game DB Finale I dont have ANY src.'s, thats not an exaggeration, NONE. If you don't put src., its still src, in all cases I have ever come across, so I never even use it.

You dont need the =TRUE&whatever, if it =whatever, its still true.

If src is p1, then p1 is true.
In response to Rickoshay
It's likely threads take up very, very little space.
In response to Dragonn
No, stop. Just stop. Stop, stop, stop, stop, stop. Stop it. Quit right now. Do not continue. End this mindless game of posting bad code. Quit, end, halt, stop, and whatever other word you can think of. That code is bad. The switch() is useless, the method of using locate() is valid, but there are far better, easier ways, and you shouldn't give advice on what & does, because you obviously don't even know what it is freaking for. This whole program can be handled in a far better way, preferably with a datum for a single game. Chances are you don't even know what a datum is, though.

Stop posting bad code.
In response to Popisfizzy
I've taken the liberty to create a "correct" way to do this.

var
players[4] // Creates a player "master" list with 4 sub lists.
p = 0
mob
Login()
..() // Execute the main Procedure of Login() before doing the following.
if(p>=4) // if there are more then 4 players playing.
src<<"There are not currently any games available!"
View() // calls the "View" proc
return
p++ // adds 1 to p
players[p]=src // sets the player (p is the list number) list to src
icon=null // just replace "null" with your icon.
src<<"You are player [p]!" // displays what player they are.
world<<"[src] has logged in as player [p]!" // displays to the world that src has logged in and is playing
proc
View()
world<<"[src] is currently viewing."


There are much better ways of doing it, like PopisFizzy said, use a datum, but i'm lazy(and bored <_<).

[edit]

Removed the else statment, it was useless
In response to Axerob
Uh, that code won't work.
In response to Axerob
Axerob wrote:
I've taken the liberty to create a "correct" way to do this.

> var
> players[4] // Creates a player "master" list with 4 sub lists.
> p = 0
> mob
> Login()
> ..() // Execute the main Procedure of Login() before doing the following.
> if(p>=4) // if there are more then 4 players playing.
> src<<"There are not currently any games available!"
> View() // calls the "View" proc
> return
> p++ // adds 1 to p
> players[p]=src // sets the player (p is the list number) list to src
> icon=null // just replace "null" with your icon.
> src<<"You are player [p]!" // displays what player they are.
> world<<"[src] has logged in as player [p]!" // displays to the world that src has logged in and is playing
> else
> View() // calls View Proc.
> proc
> View()
> world<<"[src] is currently viewing."

There are much better ways of doing it, like PopisFizzy said, use a datum, but i'm lazy(and bored <_<).

What's this for?
    else
View() // calls View Proc.
In response to Jemai1
That's just bad indentation. It really should be one tab to the right.
In response to TikaPSO13
Also incorrect, because there's no if() block preceding it.
In response to Garthor
Garthor wrote:
Also incorrect, because there's no if() block preceding it.

I had orginally made it using switch(), but after looking at it, i realized that it was useless and i forgot to remove the else part part :3

var
players[4] // Creates a player "master" list with 4 sub lists.
p = 0
mob
Login()
..() // Execute the main Procedure of Login() before doing the following.
if(p>=4) // if there are more then 4 players playing.
src<<"There are not currently any games available!"
View() // calls the "View" proc
return
p++ // adds 1 to p
players[p]=src // sets the player (p is the list number) list to src
icon=null // just replace "null" with your icon.
src<<"You are player [p]!" // displays what player they are.
world<<"[src] has logged in as player [p]!" // displays to the world that src has logged in and is playing
proc
View()
world<<"[src] is currently viewing."


I'm actually surprised that it even compiled(the one with the else hanging about), but that code does work, i've already tested it.