ID:169810
 
I was wondering, how exactly do you create a browser? Not one that opens a web page in the Browser button, but a hand made one that pops up when one logs in, for like, say, a manual, complete with CSS/HTML etc abilities. Not an alert, either.

Also, I have a coding problem to adress.

I have 2 procs I would like a world-say message to go through. A filter, and a smiley replacement.

I have tried:
        WSay(msg as text) // yeah, we'll let you talk to the entire world this time. same spamming protection as Say
if(muted==0)
if(length(msg)<=255)
if(ratelimit<=5)
var/mob/players/m = usr
world << "<font color = blue><b>([m.char_class])[usr] <font color = blue>wsays: [s_smileys&&filter(msg)]"
ratelimit++
else
usr << "<b>You are over the rate limit. Please wait..."
ratelimit=10
else
usr << "<b>Don't spam, the limit is 255 characters."
else
usr << "<font color = purple>The Creator has muted you! No one hears you."


And it only does the filter, so it stands as:
        WSay(msg as text) // yeah, we'll let you talk to the entire world this time. same spamming protection as Say
if(muted==0)
if(length(msg)<=255)
if(ratelimit<=5)
var/mob/players/m = usr
world << "<font color = blue><b>([m.char_class])[usr] <font color = blue>wsays: [s_smileys(msg)]"
ratelimit++
else
usr << "<b>You are over the rate limit. Please wait..."
ratelimit=10
else
usr << "<b>Don't spam, the limit is 255 characters."
else
usr << "<font color = purple>The Creator has muted you! No one hears you."

For now.

The last thing, is that I am severely needing a verb that allows you to hide tabs. If you reply to my message, please page me.
For the browser, give the thing a name.
mob/verb/test(T)
src<<browse(T,"window=test")

To close it, send another browse with the same window parameter where the first argument is empty.

For sending something through two different functions, either do it one line at a time, resetting the variable each time, or pass the restulf of one function in to the other.
mob
proc
bold(T)
return "<b>[T]</b>"
underline(T)
return "<u>[T]</u>"
verb/test(T)
src<<"[underline(bold(T))]"

mob
proc
bold(T)
return "<b>[T]</b>"
underline(T)
return "<u>[T]</u>"
verb/test(T)
T=bold(T)
T=underline(T)
src<<T

As for hiding tabs, that depends on whether they are statpanel tabs or verb panel tabs.

For verbs, just set the category of all the verbs that would otherwise be in a tab to null.

For statpanels, just don't let the part for the tab in question to be executed.
mob
var/check_contents=0
verb/check_contents()
check_contents=!check_contents
Stat()
if(check_contents)
statpanel("contents",contents)
In response to Loduwijk
I meant as a pop up window, for the browser thing.



Also, I'm talking about statpanels, but I'd like to have it where the user can decide whether he or she wants this panel open or that panel open.
In response to Sinoflife
If you use browse("Stuff","window=test") it will pop up in a pop-up browser window (although not in your default browser). Give it a try.

As for statpanels:

mob/Stat()
if(Stat1)
statpanel("One!")
stat("Cheese!")
if(Stat2)
statpanel("Two!")
stat("More cheese!")


That presupposes that mobs have a Stat1, Stat2, etc. variable defined. And you'll need to set them yourself.
In response to Sinoflife
Sinoflife wrote:
I meant as a pop up window, for the browser thing.

The second argument of browse() allows you to make popup windows by specifying "window=[window_name];", as Loduwijk did in the demo code he posted.


Also, I'm talking about statpanels, but I'd like to have it where the user can decide whether he or she wants this panel open or that panel open.

The Turning Off Stat Panelssection of my "Guide to Verb and Stat Panels" describes the basics (as did Loduwijk). If you intend to do it with multiple panels, it may be best to use bit flags or a list instead of an separate flag variable for each panel.
In response to Jp
Great, great. You guys've been a huge help.

Just one more question about the pop up browser, how do you add links that will switch you to a new window in the pop up browser. Sorry if I'm not too good with wording, but not an actual web page, but not another pop up browser, the same pop up with a different page.

I was thinking about jumplinking, but i'd rather have a new page.

How would I go about customizing it with HTML and CSS?
In response to Sinoflife
You can update the window by using browse with the same window parameter.
client
Topic(href,href_list[],hsrc)
switch(href_list["action"])
if("goto_page1")
start()
if("goto_page2")
page2()
verb/start()
src<<browse("This is page one. <a href=\"?action=goto_page2\">Go to page two.</a>","window=MyWindow")
proc/page2()
src<<browse("This is page two. <a href=\"?action=goto_page1\">Back to page one.</a>","window=MyWindow")