ID:138354
 
I would *really* like to pass some data with my link to say which link had been used or include a variable specific to that link. I'm generating a list of objects and turning them into links using a loop, the objects are different but link to the same proc, the problem is that the proc doesn't know which link was clicked. I can't use the GetVal routines because of the way the links are being generated.

Is there any fudge I can make to the submitlink library to transfer the link name to the called proc, or ideally, a typed variable to the called proc?

[edit] I'm intrigued by the very odd behaviour that is obtained by putting "/proc/myproc()" in the place of /proc/myproc in slOutputLink. It appears to execute the first verb in the first area verb list?!?
On 10/10/00 11:29 am Al wrote:
I would *really* like to pass some data with my link to say which link had been used or include a variable specific to that link. I'm generating a list of objects and turning them into links using a loop, the objects are different but link to the same proc, the problem is that the proc doesn't know which link was clicked. I can't use the GetVal routines because of the way the links are being generated.

Is there any fudge I can make to the submitlink library to transfer the link name to the called proc, or ideally, a typed variable to the called proc?

Probably. But without my trusty Dream Maker here at school with me, you'll have to wait a couple hours until I get home for a possible answer. =)
On 10/10/00 11:29 am Al wrote:

Is there any fudge I can make to the submitlink library to transfer the link name to the called proc, or ideally, a typed variable to the called proc?

I guess I'll need a more specific example of the situation, since I would use slSetVal()/slGetVal() for the purpose.

Example:

/proc/myLink(list/myList)
var/O
var/T
for(O in myList)
T = ""
T += slSetVal("obj",O)
usr << slOutputLink(T,/proc/myCallback,"Click [O]")

/proc/myCallback()
var/O = slGetVal("obj")
usr << "You clicked [O]"

[edit] I'm intrigued by the very odd behaviour that is obtained by putting "/proc/myproc()" in the place of /proc/myproc in slOutputLink. It appears to execute the first verb in the first area verb list?!?

That's weird. Anyway, you shouldn't doing that!
In response to Tom H.
On 10/10/00 1:29 pm Tom H. wrote:
On 10/10/00 11:29 am Al wrote:

Is there any fudge I can make to the submitlink library to transfer the link name to the called proc, or ideally, a typed variable to the called proc?

I guess I'll need a more specific example of the situation, since I would use slSetVal()/slGetVal() for the purpose.

Example:

/proc/myLink(list/myList)
var/O
var/T
for(O in myList)
T = ""
T += slSetVal("obj",O)

I didn't realise you could do this, I guess the link index is used to find the correct position in T... Thanks

usr << slOutputLink(T,/proc/myCallback,"Click [O]")

/proc/myCallback()
var/O = slGetVal("obj")
usr << "You clicked [O]"

[edit] I'm intrigued by the very odd behaviour that is obtained by putting "/proc/myproc()" in the place of /proc/myproc in slOutputLink. It appears to execute the first verb in the first area verb list?!?

That's weird. Anyway, you shouldn't doing that!
sorry :-(
In response to Tom H.
On 10/10/00 1:29 pm Tom H. wrote:
On 10/10/00 11:29 am Al wrote:

Is there any fudge I can make to the submitlink library to transfer the link name to the called proc, or ideally, a typed variable to the called proc?

I guess I'll need a more specific example of the situation, since I would use slSetVal()/slGetVal() for the purpose.

Example:

/proc/myLink(list/myList)
var/O
var/T
for(O in myList)
T = ""
T += slSetVal("obj",O)
usr << slOutputLink(T,/proc/myCallback,"Click [O]")

/proc/myCallback()
var/O = slGetVal("obj")
usr << "You clicked [O]"
This is exactly what I want to do, but it doesn't actually work for me. (I changed slSetVal to slSetLinkVal) In fact I can't actually get your example to compile (yes, I did pass a list to it), but when I applied this method to my problem it runs, but always returns the first object in the list.
In response to Al
On 10/10/00 2:52 pm Al wrote:

This is exactly what I want to do, but it doesn't actually work for me. (I changed slSetVal to slSetLinkVal) In fact I can't actually get your example to compile (yes, I did pass a list to it), but when I applied this method to my problem it runs, but always returns the first object in the list.

I bet you aren't declaring the list properly. Here's a complete example that works for me:

****

proc/myLink(list/myList)
var/O
var/T
for(O in myList)
T = ""
T += slSetLinkVal("obj",O)
usr << slOutputLink(T,/proc/myCallback,"Click [O]")

/proc/myCallback()
var/O = slGetVal("obj")
usr << "You clicked [O]"

mob/verb/test()
var/obj/O1 = new /obj
O1.name = "one"
var/obj/O2 = new /obj
O2.name = "two"
var/obj/O3 = new /obj
O3.name = "three"
var/list/L = list(O1,O2,O3)
myLink(L)

****

I hope that helps.
In response to Tom H.
On 10/10/00 3:22 pm Tom H. wrote:
proc/myLink(list/myList)
var/O
var/T
for(O in myList)
T = ""
T += slSetLinkVal("obj",O)
usr << slOutputLink(T,/proc/myCallback,"Click [O]")

/proc/myCallback()
var/O = slGetVal("obj")
usr << "You clicked [O]"

mob/verb/test()
var/obj/O1 = new /obj
O1.name = "one"
var/obj/O2 = new /obj
O2.name = "two"
var/obj/O3 = new /obj
O3.name = "three"
var/list/L = list(O1,O2,O3)
myLink(L)

****

I hope that helps.

Thanks, I had my T = "" in the wrong place (outside the loop) and my test environment still had the old submitlink library with the / missing from the const defs. This is a really good feature, I didn't realise that it would work like that. I had a look at the new forms stuff and thought it was much better, I'll definitely switch when you integrate the other submitlink stuff into it.
PS. How's the online ordering coming along, my plastic is burning a hole in my pocket!