Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Tue May 06, 2008 10:05 pm   

why won't this work? (long code...)
 
Hey all... For some reason, this isn't working very well, and... I can't seem to figure out why. This is everything I've got, so it will be kinda long, I apologize in advance. But as soon as its done, it can be put in the finished scripts folder. =]

Code:
#CLASS {aliases}
#CLASS 0
#CLASS {aliases|core}
#ALIAS load {#if (@bsync) {#variable scriptstate %1;#variable bkill 1;#variable key_list {};#variable sob_list {};#variable gob_list {};#variable mob_list %array( 0);#variable line 2;#file 1 NOD_%1.txt;#variable line_max %filesize( 1);#if (%word( %read( 1, 1), 1) = "MOBDEF") {#loop 0,%eval( %word( %read( 1, 1), 2) - 1) {#noop %arrset( mob_list, %i, 0);#variable key_list %additem( %word( %read( 1, @line), 2), @key_list);#add line 1;#variable sob_list %additem( %read( 1, @line), @sob_list);#add line 1;#variable gob_list %additem( %read( 1, @line), @gob_list);#add line 1};#if (%read( 1, @line) = "PATH") {#status {Go to starting room and use 'begin' to start.}}} {#echo Invalid script file.}} {#echo Tick not synched! Synch time first...}}
#ALIAS begin {#t+ scriptcore;#variable bcombat 0;#status {Tick: @tick ---- Script: @scriptstate ---- Line: @line / @line_max};look}
#ALIAS set {#if (%1 = "att") {#if (%2 = "stun") {#variable attack {stun};#window misc ~>~<~>~> attack set to stun ~<~<~>~<};#if (%2 = "temp") {#variable attack {temp tou};#window misc ~>~<~>~> attack set to temple touch ~<~<~>~<};#if (%2 = "keii") {#variable attack keii;#window misc ~>~<~>~> attack set to keiiken ~<~<~>~<};#if (%2 = "vic") {#variable attack {vici fis};#window misc ~>~<~>~> attack set to vicious fist ~<~<~>~<};#if (%2 = "kill") {#variable attack k;#window misc ~>~<~>~> normal attack ~<~<~>~<}};#if (%1 = "pool") {#if (%2 = "man") {#variable man_min %3;#window misc ~>~<~>~> mana set to %3 ~<~<~>~<};#if (%2 = "spi") {#variable spi_min %3;#window misc ~>~<~>~> spi set to %3 ~<~<~>~<};#if (%2 = "end") {#variable end_min %3;#window misc ~>~<~>~> end set to %3 ~<~<~>~<};#if (%2 = "hit") {#variable hit_min %3;#window misc ~>~<~>~> hps set to %3 ~<~<~>~<}}}
#ALIAS end {#IF (@bsync) {#T- scriptcore;#variable bkill 0;#STATUS {Tick: @tick ---- Use 'load' to open a script file.};#CLOSE 1} {#ECHO {};#ECHO {};#ECHO Tick timer unsynchronized - wait in temple for tick.}}
#CLASS 0
#CLASS {aliases|spells}
#ALIAS zin {invoke 'medatative regeration'}
#CLASS 0
#CLASS {variables}
#CLASS 0
#CLASS {variables|core}
#VAR arrnext {0}
#VAR attack {k}
#VAR bcombat {0}
#VAR bdetect {0}
#VAR bkill {0}
#VAR bmove {1}
#VAR bsync {1}
#VAR line {19}
#VAR line_max {426}
#VAR scriptstate {telgoran}
#VAR tick {60}
#VAR time_diff {37}
#VAR bsleep {0}
#CLASS 0
#CLASS {variables|pools}
#VAR end_cur {20070}
#VAR end_max {20070}
#VAR end_min {100}
#VAR hit_max {34617}
#VAR hit_min {100}
#VAR man_cur {100}
#VAR man_max {100}
#VAR man_min {100}
#VAR spi_cur {7166}
#VAR spi_max {7166}
#VAR spi_min {100}
#VAR hit_cur {34617}
#CLASS 0
#CLASS {triggers}
#TRIGGER {~[ exits} {#variable bdetect 1}
#TRIGGER {{^The aura of this place heals you.|^You recuperate faster from your enhanced physical regeneration.}} {#VARIABLE time_diff %mod( %ctime, 60);#IF (@bsync = 0) {#VARIABLE bsync 1;#STATUS Use 'load' to open a script file.};#VARIABLE tick 60}
#TRIGGER {^~[h:&%dhit_cur/&%dhit_max] ~[m:&%dman_cur/&%dman_max] ~[s:&%dspi_cur/&%dspi_max] ~[e:&%dend_cur/&%dend_max]} {#if (@bkill) {#variable bdetect 0;#variable bcombat 1}} "" {case}
#TRIGGER {^~[H:&%dhit_cur/&%dhit_max] ~[M:&%dman_cur/&%dman_max] ~[S:&%dspi_cur/&%dspi_max] ~[E:&%dend_cur/&%dend_max]} {#if (@bkill) {#if (@bdetect) {#variable bdetect 0;act}}} "" {case}
#CLASS 0
#CLASS {scriptcore} {disable}
#CLASS 0
#CLASS {scriptcore|triggers}
#TRIGGER {(*) falls to the ground! (%w) is dead!|You hear the screams of a spirit as it flies by you.} {#if (@bcombat) {#variable bcombat 0;pop;#variable bdetect 1}} "" {disable}
#TRIGGER {They aren't here.|There is no one here by that name.|(*) falls to the ground! (%w) is dead!|You hear the screams of a spirit as it flies by you.} {#if (@bcombat) {#variable bcombat 0;pop;#variable bdetect 1}}
#TRIGGER {You lack the required endurance to perform this action.|You lack the endurance to go there.} {#5 zin}
#CLASS 0
#CLASS {scriptcore|triggers|detect}
#TRIGGER {{@gob_list}} {#IF (%ismember( %trimright( %left( %line, %eval( %pos( ~[, %line) - 1))), @gob_list)) {#NOOP %arrset( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimright( %left( %line, %eval( %pos( ~[, %line) - 1))), @gob_list)), @key_list) - 1), %eval( %arrget( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimright( %left( %line, %eval( %pos( ~[, %line) - 1))), @gob_list)), @key_list) - 1)) + %copy( %line, %eval( %pos( ~[, %line) + 2), %eval( %eval( %pos( ~], %line) - 2) - %eval( %pos( ~[, %line) + 2) + 1))))} {#NOOP %arrset( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimleft( %right( %line, %eval( %pos( ~], %line) + 1))), @gob_list)), @key_list) - 1), %eval( %arrget( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimleft( %right( %line, %eval( %pos( ~], %line) + 1))), @gob_list)), @key_list) - 1)) + %copy( %line, %eval( %pos( ~[, %line) + 2), %eval( %eval( %pos( ~], %line) - 2) - %eval( %pos( ~[, %line) + 2) + 1))))}} "" {notrig}
#TRIGGER {{@sob_list}} {#NOOP %arrset( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimright( %line), @sob_list)), @key_list) - 1), %eval( %arrget( mob_list, %eval( %ismember( %item( @key_list, %ismember( %trimright( %line), @sob_list)), @key_list) - 1)) + 1))} "" {notrig}
#CLASS 0
#CLASS {misk}
#STAT {Tick: @tick ---- Use 'load' to open a script file.}
#CLASS 0
#CLASS {scriptcore|aliases}
#ALIAS act {#IF (@bsleep) {#IF (@tick < 5) {#WAIT 500;act} {wake;#VARIABLE bsleep 0;act}} {#IF (@tick < 5) {sleep;#VARIABLE bsleep 1;act} {#IF (@hit_cur >= @hit_min) {#LOOP 0,%arrhigh( mob_list) {#IF (%arrget( mob_list, %i)) {#VARIABLE arrnext %i;#ABORT}};#IF (%arrget( mob_list, @arrnext)) {kill} {move}} {end}}}}
#ALIAS kill {#if (@bkill) {#variable bcombat 1;#if (@end_cur > @end_min) {@attack %arrget( mob_list, @arrnext)~.%item( @key_list, %eval( @arrnext + 1))} {k %arrget( mob_list, @arrnext)~.%item( @key_list, %eval( @arrnext + 1))}}}
#ALIAS move {#if (@bmove) {#add line 1;#if (%left( %read( 1, @line), 2) = "//") {#add line 1};#READ 1 @line}}
#ALIAS pop {#if (%arrget( mob_list, @arrnext)) {#noop %arrset( mob_list, @arrnext, %eval( %arrget( mob_list, @arrnext) - 1))}}
#CLASS 0
#CLASS {variables|core|mobs}
#VAR gob_list {spirits are cursed to walk this world forever.|ancient spirits take you in with a glance.|servants still desire to serve Telgoran.|priests traverse this plane, and others above.|female spirits smile at you and whisper to each other.}
#VAR key_list {tormented|old|servant|priest|female}
#VAR mob_list {<Array>|2|1|0|0|1}
#VAR sob_list {A phantom wears the ragged remains of its worship robe.|As ancient as time itself, this spirit stares at your soul.|This spirit was once a slave to the god of Telgoran.|A spirit, in the form of a regal priest, no longer leads others to his god.|Somehow, this female spirit still holds the beauty of her past life.}
#CLASS 0
#CLASS {triggers|alarms}
#ALARM "tCountdown.tick" {*1} {#IF (@tick = 0) {#VARIABLE tick 60};#ADD tick -1}
#CLASS 0
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue May 06, 2008 11:58 pm   
 
I haven't actually read this code, because it's long and because your explanation is very scant. I'm sure other people have felt the same way reading this thread (it has quite a few views for no replies), so here are some things you could do to entice us:

1) Explain what the script's supposed to do.
2) Explain what it's currently doing (or not doing) that you (don't) want it to.

Try to be as detailed as possible.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed May 07, 2008 12:52 am   
 
Sounds like a plan! =D

It doesn't do anything without loading a script, which sets up the directions to move, mob name, single mob triggers, and multiple mob triggers. What its supposed to do is load all that information (well, not the directions, it reads the file line by line as it moves room to room).

When it first gets into a room, it see's what mobs are in the room, and queues them up. Then it starts to attack each mob in turn. Once either A) finishes up with the last mob, or B) there was no mobs in the room, then it reads the next line in the script, and moves.

The problem, is that it works... But for some reason, I gotta hit the <enter> key, or something gets sent to me from the mud, to "kick things off". Is there a way to turn on what the variables are getting turned to, and as much information as possible? Maybe that'll help me see whats wrong...

Sorry about bein vague. I need to put down what I hear and see in my head, onto the forum... *wink* Lemme know what more information ya need!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net