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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
dogotemn
Beginner


Joined: 05 Jul 2007
Posts: 21

PostPosted: Thu Dec 20, 2007 5:25 am   

Issue regarding delayed variable names
 
i know the delayed %%1 syntax was removed in cmud but i believe this is a bit different and am curious as to how one should now go about it. here's my script:


auc.hit = 1
#exec {auc%2.mod = 1~;auc%2.active = 1~;auc%2.noLog = 0~;auc%2.item = ~%quote~(~"%1~"~)~;auc%2.going = ~{%ansi(bold,magenta)OPEN~}~;auc%2.wasGoing = ~{0~}~;auc%2.auctioneer = ~{%4~}~;auc%2.amount = ~{~%replace~(~"%3~",~",~",~"~"~)~}~;auc%2.bid = ~{~@auc%2.amount~}~;auc%2.upbid = ~{~@auc%2.amount~}~;auc%2.upbidNum = ~{0~}~;auc%2.bidder = ~{-None-~}~;auc%2.time = ~{%eval( (((%time( "d") * 24) * 60) * 60) + ((%time( "h") * 60) * 60) + (%time( "nn") * 60) + %time( "ss"))~}}
#exec {auc%2.stat = ~"~"}
#exec {~#if ~(~@auc%2.amount >= 1000000~) ~{auc%2.amountShort = ~{~%left(~@auc%2.amount,~%eval~(~%len~(~@auc%2.amount~) ~- 6~)~)~.~%left~(~%right~(~@auc%2.amount,~%eval~(~%len~(~@auc%2.amount~) ~- 6~)~),2~)m~}~} ~{auc%2.amountShort = ~@auc%2.amount~}}
#exec {auc%2.upbidShort = ~@auc%2.amountShort}
auc.lastUpdate = %eval( (((%time( "d") * 24) * 60) * 60) + ((%time( "h") * 60) * 60) + (%time( "nn") * 60) + %time( "ss"))
auc.update = 1
auc.read = 1
auc.reading = {%2}


while that's a lot of garbage to read the main point i'm wondering on is the:

#exec {auc%2.mod = 1}

...sort of stuff. this worked fairly well in zMud and kept me from writing an assload of triggers and whatnot. now this sort of thing seems to net me a completely botched database record variable. any clues?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Dec 20, 2007 1:00 pm   
 
These should be some working examples for all the things you were doing. Change your wildcard for capturing %3 to %n and the commas will be automatically stripped. Basically your entire usage of #EXEC is a really bad thing.
Code:
#ADDKEY {auc%2} {mod} {1}

#ADDKEY {auc%2} {item} {%1}

auc.lastUpdate = (%time( "d*24*60*60+h*60*60+nn*60+ss"))

$len=%len(@{auc%2.amount}
#if ($len >= 7) {
 #ADDKEY {auc%2} {amountShort} {%concat(%left(@{auc%2.amount},($len - 6)),".",%copy(@{auc%2.amount},($len-5),2),"m")}
} {
 #ADDKEY {auc%2} {amountShort} {@{auc%2.amount}}
}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dogotemn
Beginner


Joined: 05 Jul 2007
Posts: 21

PostPosted: Sat Dec 22, 2007 2:52 am   
 
Vijilante wrote:
These should be some working examples for all the things you were doing. Change your wildcard for capturing %3 to %n and the commas will be automatically stripped. Basically your entire usage of #EXEC is a really bad thing.
Code:
#ADDKEY {auc%2} {mod} {1}

#ADDKEY {auc%2} {item} {%1}

auc.lastUpdate = (%time( "d*24*60*60+h*60*60+nn*60+ss"))

$len=%len(@{auc%2.amount}
#if ($len >= 7) {
 #ADDKEY {auc%2} {amountShort} {%concat(%left(@{auc%2.amount},($len - 6)),".",%copy(@{auc%2.amount},($len-5),2),"m")}
} {
 #ADDKEY {auc%2} {amountShort} {@{auc%2.amount}}
}



hm. well i haven't specifically tested triggers thus far... but i know that %db(@{auc%2},amount}) works... but i don't think the #addkey {auc%2} works as i'm getting entire databases destroyed while using it. i tried doing a simple:

Code:
#ADDKEY {auc@temp} test 1
with temp = A ... doesn't seem to work. thoughts?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Dec 22, 2007 12:02 pm   
 
Use an explicit concat, like %concat("auc",@temp) or ("auc" + @temp) rather that all those implicit concats. They're only going to lead to trouble.

CMUD is more strict than zMUD about when you can implicitly concat - personally, I wish it were stricter.

Also, there's an unmatched bracket on line 7.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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