Welcome to the Builder Academy

Question Need assistance with script

More
17 Jul 2017 22:32 - 17 Jul 2017 23:26 #6797 by Aalan
Greetings fellow builders/scripters.
I am working with Gicker (thanks bro!) on his d20 Star Wars based MUD and I am trying out some higher level scripting.
So my problem is that the script fires off on the default case due to not seeing the ovnum located in the room, no matter how many of them are there... and the elseif and else cases never get seen.
This is a room enter 100 script.
script below:
Code:
if ovnumroom(21002)!=0 wait 5 %echo% With a howling roar, an ancient looking YT-700 lands and its cargo ramp drops down. wait 20 %echo% Suddenly... a repulsor sled with some sort of large livestock container comes quickly sliding out. Immediately afterwards, no sooner than the sled is off the ramp, the ship immediately takes back off again with its engines screaming in protest. The ship spins in place on its altitude thrusters, reversing its attitude, while the cargo ramp starts to close... wait 15 %echo% In the time it takes for a human to blink, the YT-700 is gone... Leaving behind only the container on its sled sitting smack-dab in the middle of the landing pad admist swirling orange haze. That pilot had to have been combat trained to be able to pull that drop, dump, and burn so well in such little time. %load% obj 21002 elseif ovnumroom(21002)>0 wait 5 %echo% Another freighter begins their approach to landing pad in an attempt to land. Upon seeing the cargo container sitting in the center of the pad, the pilot adjusts their course to land at another unoccupied landing pad. else %echo% Something seems off here. end



I could use some help in figuring out what I am doing wrong. I have tried different expressions and values... I have tried !=, ==, and >= with the corresponding values. The script runs and drops the ovnum as it is supposed to if it were null or 0...


Thanks guys!
Last edit: 17 Jul 2017 23:26 by thomas. Reason: added [code ] tags.

Please Log in or Create an account to join the conversation.

More
17 Jul 2017 23:28 - 17 Jul 2017 23:38 #6798 by thomas
Replied by thomas on topic Need assistance with script
What are you trying to accomplice with "ovnumroom" ? It's not a known dg script command: github.com/tbamud/tbamud/search?utf8=%E2...93&q=ovnumroom&type= gives 0 hits.

Edit: ahh, I see now - what you are after is
Code:
if !%self.contents(21002)% nop ...exposition... %load% obj 21002 else nop ... object exists... end
Last edit: 17 Jul 2017 23:38 by thomas. Reason: revelation :)

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 04:30 - 18 Jul 2017 04:41 #6799 by Aalan
Replied by Aalan on topic Need assistance with script
Thanks Thomas! Will test out and advise. I haven't scripted in years and my obviously rusty skills still sometimes dig up pieces of syntax from the codebases I built/scripted for back then.

Edit: That worked! So using the dg reference guide I dug up on the old.tbamud site the reference room.variable should be used as self.variable... Cool and good to know. Thank you again!
Last edit: 18 Jul 2017 04:41 by Aalan. Reason: Additonal information after trial of suggested fix.

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 05:00 #6800 by Aalan
Replied by Aalan on topic Need assistance with script
For future scripters looking for what actually worked using Thomas' suggestion, here is the corrected code:
Code:
if !%self.contents(21002)% wait 5 %echo% With a howling roar, an ancient looking YT-700 lands and its cargo ramp drops down. wait 20 %echo% Suddenly... a repulsor sled with some sort of large livestock container comes quickly sliding out. Immediately afterwards, no sooner than the sled is off the ramp, the ship immediately takes back off again with its engines screaming in protest. The ship spins in place on its altitude thrusters, reversing its attitude, while the cargo ramp starts to close... wait 15 %echo% In the time it takes for a human to blink, the YT-700 is gone... Leaving behind only the container on its sled sitting smack-dab in the middle of the landing pad admist swirling orange haze. That pilot had to have been combat trained to be able to pull that drop, dump, and burn so well in such little time. %load% obj 21002 elseif %self.contents(21002)% wait 5 %echo% As you walk out of the terminal, another freighter begins their approach to the landing pad in an attempt to land. Upon seeing the cargo container sitting in the center of the pad, the pilot adjusts their course, flying to land at another unoccupied landing pad elsewhere at the spaceport. else %echo% Something seems off here. end

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 14:13 #6801 by thomas
Replied by thomas on topic Need assistance with script

Aalan wrote: Edit: That worked! So using the dg reference guide I dug up on the old.tbamud site the reference room.variable should be used as self.variable... Cool and good to know. Thank you again!


Yeah, I dug it up, too. It's now also available at www.tbamud.com/old/Oasis_DG_pages/ (and linked from the menus). I guess it could use some TLC.
However, on TBA, we have a lot of examples. Many are also available on github: github.com/tbamud/tbamud/tree/master/lib/world/trg

Please Log in or Create an account to join the conversation.

More
18 Jul 2017 17:24 #6802 by Aalan
Replied by Aalan on topic Need assistance with script
Thanks again for the additional resources Thomas. I have submitted my builder's application, but no one else active is online whenever I try to move forward there. Rumble is online but AFK... So I have no way to access the scripts that are on TBA itself. Same user name as here, if any imms above level 32 read this and would be kind enough to promote... :) I am happy scripting fool at the moment with so many examples from Github though. I have lots of ideas and need to figure out to make them happen. So many I am looking at the arguments used. char.sex will definitely be used. Wondering why char.race does not seem to work anymore (at least on d20MUD) and how to get around that creatively. Looking at the trg.0 file it does not show it as being there, whereas the old stuff showed it as possible. But all of that should be discussed in a different thread when I need the actual assistance. ::Smiles:: I appreciate the help!

Aalan - Builder / Scripter for d20MUD.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.240 seconds