Ok here is my simple code for a read and write scroll if you meet the requirements. Can someone let me why when I write something to it, it never shows up??? Also I'd like to rename the name of the obj with a title input, anyone know what I need here to do that??
LJR
scroll
iw = 0.2
icon = 'items.dmi'
icon_state = "scroll"
var/message
verb
Read_Scroll()
set src in usr
var/mob/pc/M = usr
if(M.readwrite > 1)
M << message
Write_Scroll()
set src in usr
var/mob/pc/M = usr
if(M.readwrite > 2)
var/prompt_title = "Scroll"
var/help_text = "Enter what you would like to appear on the scroll."
var/default_value = null
message = input(help_text, prompt_title, default_value) as null|text</<>
ID:149821
Feb 13 2002, 8:48 am
|
|
In response to Sariat
|
|
Sariat wrote:
Change the bold part to if(blah => blah) you need the equals sign. That's >=, not =>. As far as I know no language puts the = first. Anyway that doesn't appear to be related to the problem, since he says he's being prompted for input, but it never appears to do anything past that point. Lummox JR |
In response to Lummox JR
|
|
And, also for future reference;
if(varname) is the same as if(varname >=1) and if(varname == TRUE) |
In response to Nadrew
|
|
Nadrew wrote:
And, also for future reference; if(varname) is the same as if(varname >=1) and if(varname == TRUE) This is actually incorrect. >=1 and <=0 are the wrong values here. if(varname) is equivalent to if(varname!=0), and if(!varname) is if(varname==0 || varname==null). (Actually I think the latter might also include "". But anyway, if(varname) usually means "if not 0 or null or some other default blank value".) Lummox JR |
Where does it now show up after you write it? When you try to read it, or when you try to write on it again or what?
scroll |
In response to Sariat
|
|
Sariat wrote:
Change the bold part to if(blah => blah) you need the equals sign. no thats not it.. I know this programming method well been using it for 15 years now. LJR |
In response to Foomer
|
|
When u select the write verb the write popup show up and I click on, it looks like it works, but then I try to read it and blank.
LJR |
In response to Nadrew
|
|
Nice chat there, but still no one has solved my problem..:(
|
Weird... I worked up this, and it works flawlessly:
<small> mob/verb |
In response to Vortezz
|
|
I tried your, but I'm also trying to prompt the usr for a name for the scroll. This compiles ok, but when I run it and try to write to the scroll, it skips the naming part and just ask me for what I want to write on the scroll. What ends up happening is I have a scroll in my inventory that has no verbs or any way to get rid of it.
Write_Scroll() set src in usr var/mob/pc/M = usr if(M.readwrite > 2) var/title = "Name Scroll" var/help = null var/default = "scroll" name = input(help, title, default) as null|text var/prompt_title = "Scroll" var/help_text = "Enter what you would like to appear on the scroll." var/default_value = null message = input(help_text, prompt_title, default_value) as null|text else usr << "Your Read/Write skill is too low." |
In response to LordJR
|
|
If you don't have any help text, then don't bother setting it to null. It could cause some screwy behavior. To fix it use:
name = input(title,default) as null|text |
Change the bold part to if(blah => blah) you need the equals sign.
-Sariat