ID:165882
 
I like the way this method doesn't create a temp mob to start. But instead of using the input proc I would like to use a pop-up browser window.

client

New()
ClientLogin()


client
proc
ClientLogin()
var/html = "<html><head><title>Welcome</title></head>"
html += "<body bgcolor=#009966; scroll=no>"
html += "<p>Welcome</p>"
if(!mobs.len) html += "<p>You Currenly Have No Saved Characters</p>"
else
html += "<table width=95% border=3 bordercolor=#000000>"
for(var/c in mobs)
html += "<tr>"
html += "<td><a href=?@_[c]><B>[c]</B></a></td>"
html += "</tr>"
html += "</table>"
html += "<p><a href=?Create_Character>Create A New Character</a></p>"
html += "<p><a href=?Delete_Character>Delete A Character</a></p>"
html += "</body></html>"
src << browse(html,"window=who;size=300x300")

client
Topic(href)
if(findtext(href,"@_"))
var/c = copytext(href,findtext(href,"@_")+2)
C_LoadMob(c)
if(href == "Create_Character")
C_CreateMob()
if(href == "Delete_Character")
C_DeleteMob()

mobs is a list of the clients saved mobs if there are any

The problem is that the browser pops up and then closes almost instantaneously. Is there something else I have to do?

There's one rule about using <code>client/New()</code>: as soon as it returns, <client>client.mob</code> has to be set, or the player will be kicked from the game.

In your example, the <code>browse()</code> instruction returns immidiatly. <code>client/New()</code> ends as <code>ClientLogin()</code> returns, and you get forcibly kicked from the game since you have no mob.

For this, you would need a <code>while()</code> loop. You can stick one at the end of <code>ClientLogin()</code> like so:

client
proc
ClientLogin()
var/html = "<html><head><title>Welcome</title></head>"
html += "<body bgcolor=#009966; scroll=no>"
html += "<p>Welcome</p>"
if(!mobs.len) html += "<p>You Currenly Have No Saved Characters</p>"
else
html += "<table width=95% border=3 bordercolor=#000000>"
for(var/c in mobs)
html += "<tr>"
html += "<td><a href=?@_[c]><B>[c]</B></a></td>"
html += "</tr>"
html += "</table>"
html += "<p><a href=?Create_Character>Create A New Character</a></p>"
html += "<p><a href=?Delete_Character>Delete A Character</a></p>"
html += "</body></html>"
src << browse(html,"window=who;size=300x300")

while(!mob)sleep(5) //do not return the proc as long as I don't have a mob


Of course, you mustn't call <code>ClientLogin()</code> afterwards, or another loop will be started (if this is done a lot of times there will be lag).
In response to Android Data
Ah, thanks I didn't realize that.