ID:261650
 
I posted earlyer on how I could get the form to wait so I simply made another proc to do it.
proc/Check_Form()
if(usr:Done==1)
New_Map_File(usr:fx,usr:fy,usr:fz,usr:FileName,usr:name)
else
spawn(30) Check_Form()
and then in the ProcessForm() proc added one line code to the end saying usr:Done=1 so it would stop the loop.

And the obj I click too get the form is bellow.
obj/newfile
name="Make New File"
icon='newfile.dmi'
Click(src)
var/Form/New_Map/frm = new()
frm:DisplayForm()
world << "[usr:fx],[usr:fy],[usr:fz],[usr:FileName]."
world << "[usr:name]."
Check_Form()

Now the fallowing runtime error is what I get after I fill out the form and it processes.
runtime error: type mismatch
proc name: New Map File (/proc/New_Map_File)
usr: Green Lime (/mob/pc)
src: null
call stack:
New Map File("10", "10", "1", "Test.dmp", "Green Lime")
Check Form()
Check Form()

If any one is woundering this is what the New_Map_File proc code looks like.

proc/New_Map_File(var/x,var/y,var/z,var/FileName,var/Host)
var/x_string,y_string,z_string,mapfile
var/counter=0
for(x=x;x>0;x--)
x_string="[x_string]a"
for(y=y;y>0;y--)
y_string={"[x_string]
[y_string]"}
for(z=z;z>0;z--)
counter+=1
z_string={"(1,1,[counter])={"
[y_string]
" }
[z_string]"}
mapfile={""a" = (/turf,/area)

[z_string]"}
world << "[counter]."
world << "[x_string],[y_string],[z_string]."
world << "[mapfile]."
world << "[usr:fx],[usr:fy],[usr:fz],[usr:FileName]."
text2file(mapfile,FileName)
// var/savefile/F = new/savefile(FileName)
world << "[Host] has made the file [FileName]."

Thats every thing except the form and I dont think its the form part but just in case I will leave it up at the bottom of this post. So please help I dont have any clue Why or What this error means or how to fix it. So im stuck please help thanks :).

Form/New_Map
form_window="New_Map"
var
mapx
mapy
mapz
fName
ProcessForm()
usr:fx = mapx
usr:fy = mapy
usr:fz = mapz
usr:FileName = fName
usr:Done = 1
HtmlLayout() return \
{"
<{center><{b>New Map<{/b><{/center><{br>
Maps max x: [mapx]

Maps max y: [mapy]

Maps max z: [mapz]

Enter File Name:

[fName]

[submit]"}
You know that ProccessForm() is called when the player clicks the submit button, so why are you using Check_Form()? Just replace Done=1 in ProcccessForm() with a call to your New_Map_File(usr:fx,usr:fy,usr:fz,usr:FileName,usr:name) proc. Not that this will fix your current error, though.
In response to Xooxer
Xooxer wrote:
You know that ProccessForm() is called when the player clicks the submit button, so why are you using Check_Form()? Just replace Done=1 in ProcccessForm() with a call to your New_Map_File(usr:fx,usr:fy,usr:fz,usr:FileName,usr:name) proc. Not that this will fix your current error, though.

I all ready tryed this before and go this current error.

runtime error: type mismatch
proc name: New Map File (/proc/New_Map_File)
usr: Green Lime (/mob/pc)
src: null
call stack:
New Map File("10", "10", "1", "Test.dmp", "Green Lime")
/Form/New_Map (/Form/New_Map): ProcessForm()
/Form/New_Map (/Form/New_Map): StopWaiting()
/Form/New_Map (/Form/New_Map): Topic("src=%5B0x21000000%5D&mapx=10&m...", /list (/list))

Which I have no idea what it means you? hehhe :)

I just thought somthing Could the error becoming from where the obj is clicked. This such, I click the obj in my stat panel. The following code bellow does this.

var/obj/newfile/f = new
var/obj/openfile/o = new
var/obj/savefile/s = new
var/obj/editfile/e = new
Stat()
statpanel("Main Menu")
stat(,f)
stat(,o)
stat(,s)
stat(,e)
You're doing yourself a vast disservice on two counts, here:

  • You use the : operator way too much. You're using it in places where . would clearly do, and in most code you should avoid it altogether. There's no excuse for putting it in here.
  • You should set your project preferences to include debugging information, so you know which line number has the type mismatch error. That will tell you where the error is happening, and you in turn can tell us.

    Lummox JR
Your problem might be that you're passing strings into New_Map_File() instead of numbers, but I forget if it puts quotes around numbers when giving errors or not.
In response to Lummox JR
Lummox JR wrote:
You're doing yourself a vast disservice on two counts, here:

  • You use the : operator way too much. You're using it in places where . would clearly do, and in most code you should avoid it altogether. There's no excuse for putting it in here.
    It gives me an error of can't find var when ever I replace : with . so how do I use that operator?
  • You should set your project preferences to include debugging information, so you know which line number has the type mismatch error. That will tell you where the error is happening, and you in turn can tell us.
  • How do I do this? Please explain
    Lummox JR
In response to Green Lime
I believe its the last option in the "build" menu in dream maker.
In response to Green Lime
If you get an error with using : instead of ., then you hnaven't defined that var for mob/. It has to be defined under mob/, not mob/whatever/. Also, put #define DEBUG in your code for the debugging info.
In response to Garthor
Garthor wrote:
If you get an error with using : instead of ., then you hnaven't defined that var for mob/. It has to be defined under mob/, not mob/whatever/. Also, put #define DEBUG in your code for the debugging info.

Well I just read the artical on ByondScape about the usr and src. So I think I undertand the diffrence between the . and : operators. Thanks Lummox JR. About the debug thingy thanks too Garthor.

I think Im just going to start this whole new map file thingy over again and just use input() procs for now. Then after im complete with the whole program I may update it to HTML interface.

Thanks for all your help though.