1
2
Apr 18 2003, 11:23 am
In response to YamiGotenks
|
|
disregard the last post, i got that almost working, now how do i define Click()?
|
In response to YamiGotenks
|
|
client/Click()
|
In response to Goku72
|
|
it still has:
InuYashaVer1.dm:17:error:Click :undefined proc |
In response to YamiGotenks
|
|
YamiGotenks wrote:
it still has: Well, post what you have for that line. |
In response to Crispy
|
|
1st line has the error
Click() if (istype(usr,/mob/create_character))//The player is a "creating character" mob usr:NewChar() //Normally, don't use the colon. We have to use it here because BYOND doesn't know that if we reach this point, then the mob is "creating_character". We do know it, so it's safe to use the colon (:). else //Whoops, not a creating character mob world.log << "[usr] clicked on [src] but is not a create_character mob" //Error message output to game host |
In response to YamiGotenks
|
|
That's because you haven't told it what Click() belongs to. You have to indent it under turf/Create, or define it as turf/Create/Click() without indenting it. I didn't do either of those things in my example because I assumed you knew you had to that.
|
In response to Crispy
|
|
gotcha,this part is the part that has errors..it has NewChar undefined proc even with your help...
turf/Create/creating_character/Click() if (istype(usr,/mob/creating_character))//The player is a "creating character" mob usr:NewChar() //Normally, don't use the colon. We have to use it here because BYOND doesn't know that if we reach this point, then the mob is "creating_character". We do know it, so it's safe to use the colon (:). else //Whoops, not a creating character mob world.log << "[usr] clicked on [src] but is not a create_character mob" //Error message output to game host turf/Create/creating_character/NewChar/NewChar layer = MOB_LAYER+150 Load_character icon = 'create.bmp' Click() usr.NewChar() density = 1 turf/Create/creating_character/LoadChar/Load_character layer = MOB_LAYER+150 Load_character icon = 'load.bmp' Click() usr.Load() density = 1 turf/Create/creating_character/Delete layer = MOB_LAYER+150 Delete_character icon = 'delete.bmp' Click() usr.DeleteCharacter2() density = 1 turf/Create/creating_character/Website layer = MOB_LAYER+150 Website icon = 'website.bmp' Click() usr.Website() density = 1 // usr <<link("http://www.angelfire.com/stars3/dbzmugenmagna/ News.html") //#include <deadron/characterhandling> //mob/proc/NewChar() client script = "<STYLE>BODY {background: black; color: red}</STYLE>" //This changes the chat room box and text colour // base_num_characters_allowed = 7 //This limits a players save files //#define BASE_MENU_CREATE_CHARACTER "Create New Character" //#define BASE_MENU_DELETE_CHARACTER "Delete Character" //#define BASE_MENU_CANCEL "Cancel" //#define BASE_MENU_QUIT "Quit" world mob = /mob/creating_character //This sets the default mob path view = 6 //This sets the default view of the mob/player name = "InuYasha Version 3" //This sets the games name hub = "YamiGotenks.InuYasha" // turf = /turf/turfs //This sets the default turf mob/Login() src.loc=locate(7,7,10) src.energylevel = src.maxenergylevel mob/creating_character Login() ..() src.loc=locate(37,27,1) world << "[usr] has just entered '[world.name]'!"//We tell the world that someone has just joined the game now usr.sight = 1 // src.Create() //This tells the src to lookup "CreateCharacter" proc/NewChar() Start //We use this just in case the character makes a null name and if so we get brought back here. var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in alittle minute var/char_name = input("Please put your character name in here.","Name") as null|text //The player makes their name here if(char_name == null) //Here we tell the game to make the player rename his/her character if they did not pick a name goto Start //This makes us go back to the "Start" if the characters name is null var/char = input(src,"Pick your character!") in list("Half-Demon","Human","Demon") //The player chooses his/her character here switch(char) if("Half-Demon") new_mob = new /mob/player/HalfDemon/InuYasha //Looking up the path "/mob/player/human" new_mob.energylevel = 10 new_mob.maxenergylevel = 10 new_mob.maxstamina = 100 new_mob.purity = 2 new_mob.will = 5 new_mob.honor = 3 if("Human") new_mob = new /mob/player/Human/Kagome //Looking up the path "/mob/player/monkey" new_mob.energylevel = 5 new_mob.maxenergylevel = 5 new_mob.maxstamina = 100 new_mob.will = 5 new_mob.honor = 5 new_mob.purity = 5 if("Demon") new_mob = new /mob/player/Demon/Naraku new_mob.energylevel = 50 new_mob.maxenergylevel = 50 new_mob.maxstamina = 100 new_mob.will = 5 new_mob.honor = 5 new_mob.purity = 1 |
In response to YamiGotenks
|
|
Aha! Now that I can see the entire thing, I can see what's going wrong. =)
turf/Create/creating_character/Click() is never being executed. Why? Well, because you've overridden it on every type of creating_character turf. In order to fix this, we need to use a bit of proc inheritance trickery. (Well, we don't HAVE to. But if we didn't we'd be duplicating a snippet of code several times. Which is bad.) First, we need to modify the turf/Create/creating_character/Click() proc a little. (I've also removed my previous comments to make it a little easier to read.) turf/Create/creating_character/Click() And then: turf/Create/creating_character/NewChar/NewChar You need to make that change to every Click() proc below that. (That is, turf/Create/creating_character/LoadChar/Load_character/ Load_character/Click(), turf/Create/creating_character/Delete/Delete_character/Click(), and turf/Create/creating_character/Website/Website/Click().) Finally, why are you using such long type paths? They work, sure, but it's way more than neccessary. This: (Notice that I've left out the Click() proc; this is just for demonstration!) <code>turf/Create/creating_character/LoadChar/ Load_character layer = MOB_LAYER+150 Load_character icon = 'load.bmp' density = 1</code> Could easily be shortened to this... <code>turf/creating_character/Load_character layer = MOB_LAYER+150 icon = 'load.bmp' density = 1</code> ...without changing anything. (Except that you'd have to change every reference to it - from the old type path to the new type path - but that should go without saying.) |
In response to Crispy
|
|
It's working better but there is a error...on the part
var/result=..() error is:proc definition not allowed inside another proc |
In response to YamiGotenks
|
|
'm wondering if anyone knows what's wrong with this code:
turf/Create/creating_character/NewChar layer = MOB_LAYER+150 NewChar icon = 'create.bmp' Click() var/result= ..() if (result) usr:NewChar() density = 1 it has an error: proc definition not allowed inside another proc on the var/result line...plz help! |
1
2