ID:270801
 
Does anyone know how to make it show whoever shows "code" link. Instead of putting it in the browser. like a popup in the chat games.
Beh, hope ya not thinking of making any chat games, there's already a lot <., Eg; wiz_chat, AChat and Chatty...

Anyways, to make a popup, instead of just "mob<<browse(code)", you have to define a window's name in order for the popup to happen, such as "mob<<browse(code,"window=[poster]code_num[number]")"

As for the syntax, dunno how they did it (mainly because I don't care >.>)... one way to achieve something similar is to find certain words (eg: var, to, in, for) and change their colour <.<

- GhostAnime
In response to GhostAnime
No, Its for my own game. Thanks.
In response to Xx Dark Wizard xX
It doesent work, they are all undefined vars.

loading Dragon Warrior.dme
Verbs.dm:122:error:view:undefined var
Verbs.dm:129:error:code:undefined var
Verbs.dm:129:error:poster:undefined var
Verbs.dm:129:error:number:undefined var
In response to Xx Dark Wizard xX
... the code I posted was an EXAMPLE. EXAMPLEs are not to be copied/psted, it is to be read and understood...


mob<<browse(HTML code here,"window = Enter Special Unique Name Here, other browse() options (use F1 to see what you can add, like size)")

Reason for the unique name is because you can close/reload that popup browse if the window name is the same.. closing is done by mob<<browse(null,"window=Unique ID here")

and what did I say about double posting? You could of edited your last post and added the line [Edited] to the topic

- GhostAnime

Edit:

Important Wise Advice: When you do not understand something, research (in the case of this topic, looking up browse() in DM Reference [F1 in DM])... if still not understood, ask... Don't expect what people give you will actually do you any good, problems can occur...


Sorry if it feels like I am belittling you but I am trying to get people to learn what they're doing so it helps them out in the long run :)
In response to GhostAnime
It was hard to understand that library, but i dont know how to display it in a popup not in your browse window. I want popup
In response to Xx Dark Wizard xX
... okay, please tell me what is so hard? Don't be afraid, speak your mind.

Regular (in the browse tab):
mob<<browse(HTML)

Popup:
mob<<browse(HTML,"window=Some Unique ID Here")

You have to define "window" in order for the browse() to be a popup rather than going into the browse tab

- GhostAnime
In response to GhostAnime
I never knew that, well i guess il fiddle around with it till it works.

edit:wouldnt it be world<<browse?
and what is window id/ I dont know that much html
In response to Xx Dark Wizard xX
Only if you wanted it to show up to all DS clients. The Window ID can be anything you want, I think.
In response to Talion Knight
ShowCode(code as message)
world<<"\icon[usr][usr] Show's [code]"
var/code = "(syntax_highlight(code,1))"

I dont know how to do it. That is wrong and i dont know how to make code a clickable link.
In response to Talion Knight
That is correct.

world<< would send the browse() to EVERYBODY in the world, which is NOT the effect you want if you want the browse() to happen to a PARTICULAR person, especially in a multiplayer game

mob/verb
User_Only()
src<<browse("Only [src] can see this","window=popup")
World_Verb()
world<<browse("All players in the world can see this","window=popup")


- GhostAnime

PS: Like I mentioned, the unique ID is there for a reason, best to show you an example (copy/paste this in your game to see the effect)

mob/verb
Test1()
set category="Test"
src<<browse("This is Test 1","window=Unique1")
Test2()
set category="Test"
src<<browse("This is Test 2","window=Unique2")
Test3()
set category="Test"
src<<browse("This is Test 3","window=Unique1")//note that the window's unique ID is the same as in Test1().. do Test1() than Test3() to see what will happen... Test3() should overwrite the information given in Test1()
Close_Unique1()
set category="Test"
src<<browse(null,"window=Unique1")
Close_Unique2()
set category="Test"
src<<browse(null,"window=Unique2")
Close_All()
set category="Test"
src<<browse(null)

In response to Xx Dark Wizard xX
This is totally a different thing now, to show the link, you have to learn about Topic()

Please, before we explain about Topic... READ THE INFORMATION OF IT FIRST! Than look at demos/libs based on it and than, when you got enough basic info, make a new post about it if you do not know how to call Topic() in which the popup will be shown...

- GhostAnime

Edit: Forgot to also say to look up Topic() in the forum search <.< and see Justin's post ([link]) >.>
In response to GhostAnime
I know world would show everyone. I dont know how to make a a href=# whatever to make a link to the popup. and popup's already have an close button on the upper right.
In response to Xx Dark Wizard xX
ref text macro
See also:
Topic proc (client)
icon text macro
locate proc
macros (text)
tag var (datum)
The \ref text macro inserts a unique identification number or text string for the following embedded object (inside []'s). If the object has a tag, that will be used. Otherwise, an internal id number is used. In either case, the embedded reference is surrounded by [] brackets.

The reason the tag is preferred is that it stands a better chance of still being valid if the object is deleted and recreated (like in a world reboot). The internal id number, on the other hand, is transient and should only be expected to remain the same for the duration of the object's existence. If you want a more permanent reference, you must assign and save the object's tag variable.

The primary use for object references embedded in text is in topic links. This allows you to encode a reference to an object in the href value of a hyperlink. (Just make sure the object does not get deleted before the user executes the link. See garbage collection.)

Topic links that contain a parameter "src" assigned to an object reference are treated somewhat specially. Unless you override client.Topic() to do otherwise, the default behavior is to call the referenced object's own Topic() procedure.

Example:
mob/verb/test()
usr << "Click <a href=?src=\ref[src];action=start>here</a>!"
mob/Topic(href,href_list[])
switch(href_list["action"])
if("start")
usr << "Starting the game..."
else
return ..()


The above example uses an embedded reference to the player's own mob to create a link to a topic handled by that mob's Topic() proc. The href_list parameter is simply the result of params2list(href).

In that example, the embedded reference was automatically converted back into an object (dereferenced) for you. If you embed references to additional objects in the href data, you would have to dereference those yourself using the locate() instruction.



Basically, \ref, browse, and mob/Topic()
In response to Xx Dark Wizard xX
well can you just show me please. I read the blue book. isnt topic for communication between worlds?
In response to Justin B
I dont know how to do it. I keep trying to do it, it doesent work. Did you see the library. this is what he uses to show the code

client/verb
Test_Syntax_Highlighting(code as message)
set name = "Test Syntax Highlighting (full_doc)"
//Put the code in the browser as a full document
src << browse(syntax_highlight(code,1))

Test_Syntax_Highlighting_Without_Fulldoc(code as message)
set name = "Test Syntax Highlighting (no full_doc)"
//Note that here, syntax_highlight() is called with
//full_doc equal to 0. If full_doc is equal to 0,
//syntax_highlight() is meant to be embedded into
//a string.
src << browse({"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="dm_syntax.css" />
<title>DM Code</title>
</head>
<body bgcolor=\"#110099\">
<table bgcolor="#ffffff" width="100%" border="1" cellpadding="5">
<tr>
<td>
[syntax_highlight(code)]
</td>
</tr>
</table>
</body>
</html>
"}
)
In response to Xx Dark Wizard xX
... that is something totally unrelated to Topic() at the momment XDWX

Take a look at what this guy did with Topic() and how he called it: http://developer.byond.com/hub/Jinjo21/HTMLShopkeeper


Remember, do not copy/paste this, READ IT!!!! Because if you do copy/paste, I will (almost) bet my soul that it will cause your game to be messed up severly

- GhostAnime

Edit: Though I admit it is not a good demo file (feh, most of the lib/demos aren't "good" anyways), it is there to convey how to do Topic()... what you read up on, if you don't know already, are /list (aka array)
In response to GhostAnime
I will read it and such but I am creating my verb system and that would really help. I'm just asking if you can give me a few lines of code to help me out.
In response to Xx Dark Wizard xX
Very well, here is an example (not sure if it'll work though, doing this from memory):
mob/verb/Show_Topic() src<<link("byond://?Show=Example")
mob/verb/Test2() src<<link("byond://?Test")

client/Topic(href,href_list[])
if(href["Show"]) mob<<browse(href["Show"])
else if(href=="Test")//checks if there is a single value
mob<<browse("Yay","window=U1")
return..()//This is important, NEVER do just "return" in client/Topic.. it can mess you ip
In response to GhostAnime
both gave runtime errors

mob
verb
ShowCode(code as message)
world<<"\icon[usr][usr] shows (popup with code and name code"
Page: 1 2